diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 0000000..01385bb --- /dev/null +++ b/.typos.toml @@ -0,0 +1,12 @@ +# https://github.com/crate-ci/typos +# install: cargo install typos-cli +# run: typos + +# Ignore the contents of localization files (but check their names) +[type.po] +extend-glob = ["*.po"] +check-file = false + +[type.ftl] +extend-glob = ["*.ftl"] +check-file = false diff --git a/i18n-build/src/gettext_impl/mod.rs b/i18n-build/src/gettext_impl/mod.rs index d6b004f..a4aba63 100644 --- a/i18n-build/src/gettext_impl/mod.rs +++ b/i18n-build/src/gettext_impl/mod.rs @@ -154,7 +154,7 @@ fn crate_module_pot_file_path>(crt: &Crate<'_>, pot_dir: P) -> Pa .with_extension("pot") } -/// Run the gettext utils `msgcat` command to concatinate pot files +/// Run the gettext utils `msgcat` command to concatenate pot files /// into a single pot file. pub fn run_msgcat, I: IntoIterator>( input_pot_paths: I, @@ -174,7 +174,7 @@ pub fn run_msgcat, I: IntoIterator>( } info!( - "Concatinating pot files {0:?} with `msgcat` into \"{1}\"", + "Concatenating pot files {0:?} with `msgcat` into \"{1}\"", input_pot_paths_strings, output_pot_path.as_ref().to_string_lossy() ); @@ -456,32 +456,32 @@ pub fn run(crt: &Crate) -> Result<()> { } // figure out where there are any subcrates which need their output - // pot files concatinated with this crate's pot file - let mut concatinate_crates = vec![]; + // pot files concatenated with this crate's pot file + let mut concatenate_crates = vec![]; for subcrate in &subcrates { run(subcrate)?; if subcrate.collated_subcrate() { - concatinate_crates.push(subcrate); + concatenate_crates.push(subcrate); } } - // Perform the concatination (if there are any required) - if !concatinate_crates.is_empty() { + // Perform the concatenation (if there are any required) + if !concatenate_crates.is_empty() { assert!(crt.gettext_config_or_err()?.collate_extracted_subcrates); - concatinate_crates.insert(0, crt); + concatenate_crates.insert(0, crt); - let concatinate_crate_paths: Vec = concatinate_crates + let concatenate_crate_paths: Vec = concatenate_crates .iter() .map(|concat_crt: &&Crate| crate_module_pot_file_path(concat_crt, &pot_dir)) .collect(); let output_pot_path = crate_module_pot_file_path(crt, &pot_dir); - run_msgcat(concatinate_crate_paths, output_pot_path)?; + run_msgcat(concatenate_crate_paths, output_pot_path)?; // remove this crate from the list because we don't want to delete it's pot file - concatinate_crates.remove(0); + concatenate_crates.remove(0); - for subcrate in concatinate_crates { + for subcrate in concatenate_crates { let subcrate_output_pot_path = crate_module_pot_file_path(subcrate, &pot_dir); util::remove_file_or_error(subcrate_output_pot_path)?; } diff --git a/i18n-config/src/lib.rs b/i18n-config/src/lib.rs index e96414d..0cb2fc5 100644 --- a/i18n-config/src/lib.rs +++ b/i18n-config/src/lib.rs @@ -1,4 +1,4 @@ -//! This library contains the configuration stucts (along with their +//! This library contains the configuration structs (along with their //! parsing functions) for the //! [cargo-i18n](https://crates.io/crates/cargo_i18n) tool/system. @@ -301,7 +301,7 @@ impl<'a> Crate<'a> { if this_is_subcrate { Some(crt) } else { - debug!("Parent {0} does not have {1} correctly listed as one of its subcrates (curently: {2:?}) in its i18n config.", crt, self, config.subcrates); + debug!("Parent {0} does not have {1} correctly listed as one of its subcrates (currently: {2:?}) in its i18n config.", crt, self, config.subcrates); None } } diff --git a/i18n-embed-fl/examples/web-server/src/main.rs b/i18n-embed-fl/examples/web-server/src/main.rs index 1e86087..5cfc13a 100644 --- a/i18n-embed-fl/examples/web-server/src/main.rs +++ b/i18n-embed-fl/examples/web-server/src/main.rs @@ -20,30 +20,30 @@ fn main() { println!( "requested [en-US], response: {}", - hande_request(&loader, &[&"en-US".parse().unwrap()]) + handle_request(&loader, &[&"en-US".parse().unwrap()]) ); println!( "requested [ka-GE], response: {}", - hande_request(&loader, &[&"ka-GE".parse().unwrap()]) + handle_request(&loader, &[&"ka-GE".parse().unwrap()]) ); println!( "requested [en-UK], response: {}", - hande_request(&loader, &[&"en-UK".parse().unwrap()]) + handle_request(&loader, &[&"en-UK".parse().unwrap()]) ); println!( "requested [de-AT], response: {}", - hande_request(&loader, &[&"de-AT".parse().unwrap()]) + handle_request(&loader, &[&"de-AT".parse().unwrap()]) ); println!( "requested [ru-RU], response: {}", - hande_request( + handle_request( &loader, &[&"ru-RU".parse().unwrap(), &"de-DE".parse().unwrap()] ) ); } -fn hande_request( +fn handle_request( loader: &FluentLanguageLoader, requested_languages: &[&unic_langid::LanguageIdentifier], ) -> String { diff --git a/i18n-embed-fl/src/lib.rs b/i18n-embed-fl/src/lib.rs index e68c915..11bdf40 100644 --- a/i18n-embed-fl/src/lib.rs +++ b/i18n-embed-fl/src/lib.rs @@ -276,7 +276,7 @@ fn domains() -> &'static dashmap::DashMap { /// runtime using a [HashMap](std::collections::HashMap), using the /// same signature as in /// [FluentLanguageLoader::get_args()](i18n_embed::fluent::FluentLanguageLoader::get_args()). -/// When using this method of specifying argments, they are not +/// When using this method of specifying arguments, they are not /// checked at compile time. /// /// ### Example diff --git a/i18n-embed/CHANGELOG.md b/i18n-embed/CHANGELOG.md index ec2c437..7411efa 100644 --- a/i18n-embed/CHANGELOG.md +++ b/i18n-embed/CHANGELOG.md @@ -27,12 +27,12 @@ + New `autoreload` crate feature. + `RustEmbedNotifyAssets` - A wrapper for `rust_embed::RustEmbed` that supports notifications when files have changed on the file system. + `FileSystemAssets::notify_changes_enabled()` - A new method to enable watching for changes. -+ `AssetsMultiplexor` - A way to multiplex implmentations of [`I18nAssets`] where assets are multiplexed by a priority. ++ `AssetsMultiplexor` - A way to multiplex implementations of [`I18nAssets`] where assets are multiplexed by a priority. ### Breaking + Modified `I18nAssets` trait. - + Support multiple files referencing the same asset (to allow a heirachy of overrides). + + Support multiple files referencing the same asset (to allow a hierarchy of overrides). + Support for subscribing to updates to assets. + Remove deprecated methods for `LanguageConfig`, Please use `lang(...).get_attr_args(...)` etc instead. + `LanguageConfig::get_lang()` @@ -82,7 +82,7 @@ - A new `LanguageLoader::load_available_languages()` method to load all available languages. - A new `FluentLanguageLoader::select_languages()` method (renamed `FluentLanguageLoader::lang()`). -- A new `FluentLanguageLoader::select_languages_negotiate()` method to select languages based on a negotiation strategy using the available languges. +- A new `FluentLanguageLoader::select_languages_negotiate()` method to select languages based on a negotiation strategy using the available languages. ### Deprecated @@ -179,7 +179,7 @@ done in #84. ### Internal Changes -- Updated `FluentLanguageLoader` to use a thread safe [IntlLangMemoizer](https://docs.rs/intl-memoizer/0.5.1/intl_memoizer/concurrent/struct.IntlLangMemoizer.html) as per the notes on [FluentBundle's concurrency](https://docs.rs/fluent-bundle/0.15.0/fluent_bundle/bundle/struct.FluentBundle.html#concurrency). This was required to solve a compilation error in `i18n-embed-fl` and may also fix problems for other downstream users who were expecting `FluentLangaugeLoader` to be `Send + Sync`. It might impact performance for those who are not using this in multi-threaded context, please report this, and in which case support for switching the `IntlLangMemoizer` added. +- Updated `FluentLanguageLoader` to use a thread safe [IntlLangMemoizer](https://docs.rs/intl-memoizer/0.5.1/intl_memoizer/concurrent/struct.IntlLangMemoizer.html) as per the notes on [FluentBundle's concurrency](https://docs.rs/fluent-bundle/0.15.0/fluent_bundle/bundle/struct.FluentBundle.html#concurrency). This was required to solve a compilation error in `i18n-embed-fl` and may also fix problems for other downstream users who were expecting `FluentLanguageLoader` to be `Send + Sync`. It might impact performance for those who are not using this in multi-threaded context, please report this, and in which case support for switching the `IntlLangMemoizer` added. ## v0.11.0 @@ -195,7 +195,7 @@ done in #84. ### New Features -- New `LanguageRequester::add_listener_ref()` method to add permenant listeners of type `&dyn Localizer`. This also affects `DesktopLanguageRequester` and `WebLanguageRequester`. +- New `LanguageRequester::add_listener_ref()` method to add permanent listeners of type `&dyn Localizer`. This also affects `DesktopLanguageRequester` and `WebLanguageRequester`. ### Internal Changes @@ -255,7 +255,7 @@ done in #84. ## v0.8.6 -- Update documentation and example to more accurately reflect the current state of `LangaugeRequester::poll()` on various systems. +- Update documentation and example to more accurately reflect the current state of `LanguageRequester::poll()` on various systems. ## v0.8.5 @@ -278,7 +278,7 @@ done in #84. ### New Features -- Added a new `with_mesage_iter()` method to `FluentLanguageLoader`, to allow iterating over the messages available for a particular language. +- Added a new `with_message_iter()` method to `FluentLanguageLoader`, to allow iterating over the messages available for a particular language. - Added `Default` implementation for `WebLanguageRequester`. ## v0.8.2 @@ -306,7 +306,7 @@ Changes to support the new `i18n-embed-fl` crate's `fl!()` macro, and some major - Removed `I18nEmbed` trait, and derive macro, it was replaced with the new `I18nAssets` trait. - Clarified the `domain` and `module` arguments/variable inputs to `FluentLanguageLoader` and `GettextLanguageLoader`, and in the `LanguageLoader` trait with some renaming. -- Removed a bunch of unecessary lifetimes, and `'static` bounds on types, methods and arguments. +- Removed a bunch of unnecessary lifetimes, and `'static` bounds on types, methods and arguments. - `LanguageRequester::current_languages()`'s return type now uses `String` as the `HashMap` key instead of `&'static str`. - `available_languages()` implementation moved from `I18nEmbed` to `LanguageLoader`. diff --git a/i18n-embed/examples/library-fluent/src/lib.rs b/i18n-embed/examples/library-fluent/src/lib.rs index fa5b049..09aef52 100644 --- a/i18n-embed/examples/library-fluent/src/lib.rs +++ b/i18n-embed/examples/library-fluent/src/lib.rs @@ -17,7 +17,7 @@ pub static LOCALIZATIONS: Lazy> = Lazy static LANGUAGE_LOADER: Lazy = Lazy::new(|| { let loader: FluentLanguageLoader = fluent_language_loader!(); - // Load the fallback langauge by default so that users of the + // Load the fallback language by default so that users of the // library don't need to if they don't care about localization. loader .load_fallback_language(&*LOCALIZATIONS) diff --git a/i18n-embed/src/assets.rs b/i18n-embed/src/assets.rs index 6a91ce3..c0cd5d4 100644 --- a/i18n-embed/src/assets.rs +++ b/i18n-embed/src/assets.rs @@ -209,7 +209,7 @@ fn notify_watcher( /// An entity that watches for changes to localization resources. /// /// NOTE: Currently we rely in the implicit [`Drop`] implementation to remove file system watches, -/// in the future ther may be new methods added to this trait. +/// in the future there may be new methods added to this trait. pub trait Watcher {} #[cfg(feature = "autoreload")] @@ -283,7 +283,7 @@ impl I18nAssets for FileSystemAssets { } } -/// A way to multiplex implmentations of [`I18nAssets`]. +/// A way to multiplex implementations of [`I18nAssets`]. pub struct AssetsMultiplexor { /// Assets that are multiplexed, ordered from most to least priority. assets: Vec>, diff --git a/i18n-embed/src/fluent.rs b/i18n-embed/src/fluent.rs index ac1f2fb..b910b3f 100644 --- a/i18n-embed/src/fluent.rs +++ b/i18n-embed/src/fluent.rs @@ -75,7 +75,7 @@ struct FluentLanguageLoaderInner { current_languages: CurrentLanguages, } -/// [LanguageLoader] implemenation for the `fluent` localization +/// [LanguageLoader] implementation for the `fluent` localization /// system. Also provides methods to access localizations which have /// been loaded. /// diff --git a/i18n-embed/src/lib.rs b/i18n-embed/src/lib.rs index 52ae006..7f8a7bb 100644 --- a/i18n-embed/src/lib.rs +++ b/i18n-embed/src/lib.rs @@ -329,7 +329,7 @@ //! LANGUAGE_LOADER.get_or_init(|| { //! let loader = fluent_language_loader!(); //! -//! // Load the fallback langauge by default so that users of the +//! // Load the fallback language by default so that users of the //! // library don't need to if they don't care about localization. //! // This isn't required for the `gettext` localization system. //! loader.load_fallback_language(&Localizations) @@ -526,7 +526,7 @@ pub trait Localizer { } } -/// A simple default implemenation of the [Localizer](Localizer) trait. +/// A simple default implementation of the [Localizer](Localizer) trait. pub struct DefaultLocalizer<'a> { /// The source of assets used by this localizer. pub i18n_assets: &'a (dyn I18nAssets + Send + Sync + 'static),