fa18n

Crates.iofa18n
lib.rsfa18n
version0.1.0
created_at2025-11-12 13:43:07.976167+00
updated_at2025-11-12 13:43:07.976167+00
descriptionModern i18n support library base on faml
homepagehttps://github.com/fawdlstty/fa18n
repositoryhttps://github.com/fawdlstty/fa18n
max_upload_size
id1929378
size20,410
Fawdlstty (fawdlstty)

documentation

README

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));
}
Commit count: 0

cargo fmt