docs.rs failed to build rust-i18n-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
rust-i18n-3.0.1
Rust I18n
Rust I18n is use Rust codegen for load YAML file storage translations on compile time, and give you a t! macro for simply get translation texts.
Inspired by ruby-i18n.
Usage
Load macro in your lib.rs
// Load I18n macro, for allow you use `t!` macro in anywhere.
extern crate rust_i18n;
You must put I18n YAML files in locales/
folder.
locales/
├── en.yml
├── zh-CN.yml
For example of en.yml
:
en:
hello: Hello world
messages:
hello: Hello, %{name}
Now you can use t!
macro in anywhere.
t!;
// => "Hello world"
t!
You can use rust_i18n::set_locale
to change the current locale in runtime.
;
locale;
// => "zh-CN"
set_locale
License
MIT