[][src]Crate json_gettext

JSON GetText

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.

Re-exports

pub extern crate serde_json;

Macros

get_text

Used for getting single or multiple text from context.

static_json_gettext_build

Used for including json files into your executable binary file for building a JSONGetText instance.

Structs

JSONGetText

A wrapper for context and a default key. Keys are usually considered as locales.

JSONGetTextBuilder

To build a JSONGetText instance, this struct can help you do that step by step.

Enums

JSONGetTextBuilderError
JSONGetTextError
JSONGetTextValue

Represents any valid JSON value. Reference can also be wrapped.

Value

Represents any valid JSON value.