2 个不稳定版本

0.16.0 2023年11月11日
0.15.0 2023年8月23日

213国际化(i18n)

Download history • Rust 包仓库 37/week @ 2024-03-25 • Rust 包仓库 62/week @ 2024-04-01 • Rust 包仓库 31/week @ 2024-04-08 • Rust 包仓库 73/week @ 2024-04-15 • Rust 包仓库 63/week @ 2024-04-22 • Rust 包仓库 78/week @ 2024-04-29 • Rust 包仓库 55/week @ 2024-05-06 • Rust 包仓库 35/week @ 2024-05-13 • Rust 包仓库 49/week @ 2024-05-20 • Rust 包仓库 63/week @ 2024-05-27 • Rust 包仓库 46/week @ 2024-06-03 • Rust 包仓库 48/week @ 2024-06-10 • Rust 包仓库 40/week @ 2024-06-17 • Rust 包仓库 40/week @ 2024-06-24 • Rust 包仓库 9/week @ 2024-07-01 • Rust 包仓库 13/week @ 2024-07-08 • Rust 包仓库

110 每月下载量
4 个 Crates 中使用(通过 batbox

MIT 许可证

5KB

BatBox

常用 Crates 的集合


lib.rs:

国际化

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

示例 toml 文件

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

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

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

依赖

~0.6–3MB
~64K SLoC