Skip to content

v0.3.3

Compare
Choose a tag to compare
@huacnlee huacnlee released this 09 Dec 06:22
· 203 commits to main since this release

Rust I18n Cli

Add i18n cli command for extract untranslated texts into YAML.

Use cargo install rust-i18n to installation.

$ cargo install rust-i18n
$ i18n -h
i18n 0.3.3
Jason Lee <[email protected]>
Rust I18n is a crate for loading localized text from a set of YAML mapping files. The mappings are converted into data
readable by Rust programs at compile time, and then localized text can be loaded by simply calling the provided `t!`
macro.

USAGE:
    i18n [SUBCOMMAND]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    extract    Extracts strings from source files
    help       Prints this message or the help of the given subcommand(s)

Extract all untranslated texts

$ cd your-project
$ i18n extract -l en fr zh-CN zh-HK

Checking [en] and generating untranslated texts...
Found 1 new texts need to translate.
----------------------------------------
Writing to TODO.en.yml

Checking [fr] and generating untranslated texts...
Found 11 new texts need to translate.
----------------------------------------
Writing to TODO.fr.yml

Checking [zh-CN] and generating untranslated texts...
All thing done.

Checking [zh-HK] and generating untranslated texts...
Found 11 new texts need to translate.
----------------------------------------
Writing to TODO.zh-HK.yml

Now, 4 YAML files named TODO.*.yml are created into locales/ path.