1 unstable release
Uses new Rust 2024
| 0.1.0 | Nov 12, 2025 |
|---|
#222 in Internationalization (i18n)
11KB
236 lines
fa18n
Modern i18n support library base on faml
Manual
Steps:
- Add
fa18nto yourCargo.toml
[build-dependencies]
fa18n = 0.1.0
- Create i18n resources:
i18n/
en.faml
zh.faml
en.faml:
[i18n.en]
hello0 = "hello world"
Hello = "hello {name:str}"
zh.faml:
[i18n.zh]
hello0 = "你好,世界"
Hello = "你好,{name:str}"
- Create
build.rsand add code:
fn main() {
fa18n::generate_rust("i18n/", "src/i18n.rs").unwrap();
}
- Write
main.rscode:
pub mod i18n;
use crate::i18n::*;
fn main() {
let hello = I18n::hello("maria".to_string());
println!("{}", hello.translate(I18nLocale::Zh));
}
Dependencies
~6–8MB
~158K SLoC