Thanks to visit codestin.com
Credit goes to lib.rs

1 unstable release

Uses new Rust 2024

0.1.0 Nov 12, 2025

#222 in Internationalization (i18n)

MIT license

11KB
236 lines

fa18n

Modern i18n support library base on faml

Manual

Steps:

  1. Add fa18n to your Cargo.toml
[build-dependencies]
fa18n = 0.1.0
  1. 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}"
  1. Create build.rs and add code:
fn main() {
    fa18n::generate_rust("i18n/", "src/i18n.rs").unwrap();
}
  1. Write main.rs code:
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