r_i18n
An i18n implementation in Rust.
API documentation https://crates.io/crates/r_i18n
Table of Contents generated with DocToc
Installation
To install the library, you have to put this line into your Cargo.toml file.
[]
= "version number"
Usage
Configuration
First, create the configuration with the directory that contains your translations files and your languages.
extern crate r_i18n;
use I18nConfig;
Then, load the configuration:
extern crate r_i18n;
use r_i18n;
With this example, you will need to have a en.json, fr.json and es.json inside the /translations directory. Each file should looks like that:
Example
I have a en.json file that looks like that:
Then, in my main.rs
extern crate r_i18n;
use I18n;
Now, I have a fr.json file that looks like that:
If I set the current language to french:
extern crate r_i18n;
use I18n;
Contribution guide
- Fork and Clone the repository
- Create your own branch
- Start Coding!
- Make a pull request when you're done :)