4 releases

0.1.3 Jun 23, 2023
0.1.2 Oct 25, 2021
0.1.1 Oct 24, 2021
0.1.0 Oct 17, 2021

#121 in Internationalization (i18n)

Download history 454/week @ 2023-12-12 391/week @ 2023-12-19 275/week @ 2023-12-26 345/week @ 2024-01-02 435/week @ 2024-01-09 303/week @ 2024-01-16 318/week @ 2024-01-23 191/week @ 2024-01-30 218/week @ 2024-02-06 281/week @ 2024-02-13 273/week @ 2024-02-20 384/week @ 2024-02-27 389/week @ 2024-03-05 269/week @ 2024-03-12 347/week @ 2024-03-19 240/week @ 2024-03-26

1,296 downloads per month
Used in 13 crates (via lemmy_utils)

ISC license

36KB
769 lines

rosetta-i18n

Crates.io dependency status docs.rs CI

rosetta-i18n is an easy-to-use and opinionated Rust internationalization (i18n) library powered by code generation.

rosetta_i18n::include_translations!();

println!(Lang::En.hello("world"));  // Hello, world!

Documentation

Features

  • No runtime errors. Translation files are parsed at build time, so your code will never fail due to translations anymore.
  • No dependencies. This crate aims to have the smallest runtime overheat compared to raw strings. There is no additional dependencies at runtime.
  • Standard JSON format. Translations are written in JSON file with a syntax used by many other i18n libraries. Therefore, most translation services support it out of the box.
  • String formatting is supported.

Installation

Rosetta is separated into two crates, rosetta-i18n and rosetta-build. To install both, add the following to your Cargo.toml:

[dependencies]
rosetta-i18n = "0.1"

[build-dependencies]
rosetta-build = "0.1"

Documentation

The documentation is available on https://baptiste0928.github.io/rosetta/.

You can also read the API documentation on docs.rs: rosetta-i18n and rosetta-build.

Contributing

There is no particular contribution guidelines, feel free to open a new PR to improve the code. If you want to introduce a new feature, please create an issue before.

Dependencies

~2.2–3.5MB
~56K SLoC