#json #i18n #static #multi-language

json-gettext

A library for getting text from JSON usually for internationalization

16 stable releases

1.5.3 Sep 1, 2018
1.5.2 Aug 30, 2018

#8 in Internationalization (i18n)

Download history 160/week @ 2018-08-26 50/week @ 2018-09-02

70 downloads per month
Used in 2 crates

MIT license

18KB
364 lines

JSON Get Text

Build Status Build status

This is a library for getting text from JSON usually for internationalization.

Sample Code

#[macro_use]
extern crate json_gettext;

let ctx = static_json_gettext_build!("en_US", 
            "en_US", "langs/en_US.json",
            "zh_TW", "langs/zh_TW.json"
        ).unwrap();

assert_eq!("Hello, world!", get_text!(ctx, "hello").unwrap());
assert_eq!("哈囉,世界!", get_text!(ctx, "zh_TW", "hello").unwrap());

In order to reduce the compilation time, the static_json_gettext_build macro has files compiled into your executable binary file together, only when you are using the release profile.

Crates.io

https://crates.io/crates/json-gettext

Documentation

https://docs.rs/json-gettext

License

MIT

Dependencies

~2.5MB
~52K SLoC