localization-build 0.1.3

t! macro, the easiest way.
Documentation
  • Coverage
  • 66.67%
    2 out of 3 items documented0 out of 2 items with examples
  • Size
  • Source code size: 2.6 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.04 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • neodyland/localization
    2 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Googlefan256

Localization

GitHub crates.io crates.io

localization is a lightweight localization implementation written in Rust.

Easy, error on compile time, zero runtime dependency.

Getting Started

Install

[dependencies]

localization = "0.1.2"

[build-dependencies]

localization-build = "0.1.2"

Create files

// translations/en-US/default.json
{
    "hello": "Hello {{name}}, you are {{age}} years old!"
}
// build.rs
fn main() {
    localization_build::set_root("./translations");
    localization_build::set_default_locale("en-US");
}
// main.rs
fn main() {
    let name = "John";
    let age = 42;
    let s = t!("en-US","default:hello", name, age);
    println!("{}", s);
    // output: Hello John, you are 42 years old!
}

Documentation

The documentation is available on docs.rs.

License

Distributed under the MIT License. See LICENSE for more information.