Skip to content

v0.2.0

Compare
Choose a tag to compare
@huacnlee huacnlee released this 06 Dec 13:57
· 228 commits to main since this release

BRAKE CHANGES

Rust I18n API has rewrite, now you need use i18n! macro to load locales file by manually.

This changes for allow I18n to support load translations from difference sub project.

For example:

// deps: rust-i18n
foo
  Cargo.toml
  locales
  src/lib.rs

// deps:  rust-i18n, foo
bar
  Cargo.toml
  locales
  src/lib.rs

// deps:  rust-i18n, foo and bar
your-project:
  Cargo.toml
  locales
  src/lib.rs

Is this case, Rust I18n allows foo, bar and your-project use i18n! macro to load itself's translations.

Usage:

// Load I18n macro, for allow you use `t!` macro in anywhere.
#[macro_use]
extern crate rust_i18n;

// Init translations for current crate.
i18n!("./locales");

fn main() {
  println!(t!("hello"))
}
  • Add i18n! macro to load translations and required this.
  • Add for support merge multiple YAML files.