2 unstable releases

0.16.0 Nov 11, 2023
0.15.0 Aug 23, 2023

#457 in Internationalization (i18n)

Download history 58/week @ 2025-04-30 32/week @ 2025-05-07 21/week @ 2025-05-14 17/week @ 2025-05-21 2/week @ 2025-06-04 7/week @ 2025-06-11 49/week @ 2025-06-18 48/week @ 2025-06-25 37/week @ 2025-07-02 58/week @ 2025-07-09 63/week @ 2025-07-16 44/week @ 2025-07-23 32/week @ 2025-07-30 21/week @ 2025-08-06 45/week @ 2025-08-13

150 downloads per month
Used in 5 crates (2 directly)

MIT license

5KB

Internationalization

Use batbox_i18n::gen!(mod mod_name: "path/to.toml")

Example toml file:

[en]
hello = "Hello"
world = "World"

[ru]
hello = "Привет"
world = "Мир"

Generated code with batbox_i18n::gen!(mod i18n: "hello_world.toml"):

mod i18n {
    struct Locale {
        ..
    }

    fn get(locale: &str) -> Option<&'static Locale> { .. }
    fn get_or_en(locale: &str) -> &'static Locale { .. }

    impl Locale {
        pub fn hello(&self) -> &str { .. }
        pub fn world(&self) -> &str { .. }
    }
}

BatBox

Collection of commonly useful crates

Dependencies

~0.6–3.5MB
~68K SLoC