#json #i18n #static #multi-language

json-gettext

A library for getting text from JSON usually for internationalization

23 stable releases

2.1.0 Nov 17, 2018
2.0.2 Nov 16, 2018
1.7.0 Oct 15, 2018
1.6.1 Sep 9, 2018
1.5.2 Aug 30, 2018

#24 in Internationalization (i18n)

Download history 1/week @ 2018-10-08 15/week @ 2018-10-15 46/week @ 2018-10-22 15/week @ 2018-10-29 100/week @ 2018-11-05 76/week @ 2018-11-12 91/week @ 2018-11-19 46/week @ 2018-11-26 111/week @ 2018-12-03 100/week @ 2018-12-10 41/week @ 2018-12-17 148/week @ 2018-12-24 1/week @ 2018-12-31

264 downloads per month
Used in 2 crates

MIT license

25KB
452 lines

JSON Get Text

Build Status Build status

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

Example

#[macro_use] extern crate json_gettext;
#[macro_use] extern crate lazy_static;
#[macro_use] extern crate lazy_static_include;

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
~51K SLoC