2 unstable releases

0.16.0 Nov 11, 2023
0.15.0 Aug 23, 2023

#280 in Internationalization (i18n)

Download history 33/week @ 2024-10-12 31/week @ 2024-10-19 33/week @ 2024-10-26 46/week @ 2024-11-02 3/week @ 2024-11-09 16/week @ 2024-11-16 47/week @ 2024-11-23 44/week @ 2024-11-30 75/week @ 2024-12-07 56/week @ 2024-12-14 2/week @ 2024-12-28 18/week @ 2025-01-04 44/week @ 2025-01-11 41/week @ 2025-01-18 12/week @ 2025-01-25

115 downloads per month
Used in 4 crates (via batbox)

MIT license

5KB

BatBox

Collection of commonly useful crates


lib.rs:

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 { .. }
    }
}

Dependencies

~0.5–3.5MB
~66K SLoC