2 releases
0.9.1 | Feb 24, 2022 |
---|---|
0.9.0 | Feb 20, 2022 |
#270 in Internationalization (i18n)
Used in kalgan
12KB
201 lines
kalgan-i18n
A translation tool that retrieves the messages stored in yaml files used by Kalgan Framework.
Examples
This is the yaml file to be used in the following tests:
## tests/en/messages.yaml
hello:
world: Hello World!
somebody: Hello {user}!
use kalgan_i18n::Messages;
let messages: Messages = Messages::new("tests");
assert_eq!(messages.trans("en", "hello.world", HashMap::new()), "Hello World!");
let mut parameters = HashMap::new();
parameters.insert("user", "John".to_string());
assert_eq!(messages.trans("en", "hello.somebody", parameters), "Hello John!");
Documentation
For further information please visit:
License
This crate is licensed under either of the following licenses:
Dependencies
~2MB
~40K SLoC