Fix minimal `Localize` implementation on errors

finchie
Mar 5, 2025, 9:10 AM
73C6NOJ7W7ZCQ2THEZ4HXNZF3734VIPHI5VKQ2CCPLOA4L3JFIIQC

Dependencies

  • [2] CESJ4CTO Move macro-specific code into `macro_impl` module
  • [3] OWXLFLRM Merge `cli_macros` shim into `fluent_embed`
  • [*] O77KA6C4 Create `fluent_embed` crate

Change contents

  • replacement in fluent_embed_derive/src/lib.rs at line 30
    [3.907][2.5608:5701]()
    // Generate a minimal `localize()` implementation so the error is self-contained
    [3.907]
    [2.5701]
    // Generate a minimal `Localize` implementation so the error is self-contained
  • replacement in fluent_embed_derive/src/lib.rs at line 33
    [2.5766][2.5766:5847]()
    impl #ident {
    fn localize(&self) -> String {
    [2.5766]
    [2.5847]
    #original_item
    impl<W: ::std::io::Write> ::fluent_embed::Localize<W> for #ident {
    const CANONICAL_LOCALE: ::fluent_embed::icu_locale::LanguageIdentifier =
    ::fluent_embed::icu_locale::langid!("en-US");
    fn available_locales(&self) -> Vec<::fluent_embed::icu_locale::LanguageIdentifier> {
    unimplemented!("Encountered error in derive macro")
    }
    fn message_for_locale(
    &self,
    writer: &mut W,
    locale: &::fluent_embed::icu_locale::LanguageIdentifier,
    ) -> Result<(), ::fluent_embed::LocalizationError> {
  • edit in fluent_embed_derive/src/lib.rs at line 56
    [3.951]