r18-0.2.0 has been yanked.
🔞
r18 is a crate for internationalized Rust projects.
Usage
Add r18 to your project's dependencies.
[]
= "0.1"
Create a JSON translation file whose name format is BCP 47 language tag in a directory and write it as follows:
// ./tr/zh-CN.json
Then add r18::init! to the global area of your code with the translation file directory path (is ./tr in this example) relative to your project root.
init!;
After initialization, use auto_detect! to detect locale and load translation model (optional, you can use set_locale! to set locale manually), then use tr! to translate your text which has been translated.
init!;
For a complete example, you can see here. you can run the example with:
cargo run -p example