Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/baptiste0928/rosetta
Easy to use Rust i18n library based on code generation
https://github.com/baptiste0928/rosetta
codegen i18n rust
Last synced: 15 days ago
JSON representation
Easy to use Rust i18n library based on code generation
- Host: GitHub
- URL: https://github.com/baptiste0928/rosetta
- Owner: baptiste0928
- License: isc
- Created: 2021-08-30T11:10:34.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-16T21:55:49.000Z (9 months ago)
- Last Synced: 2024-10-03T12:22:34.031Z (about 1 month ago)
- Topics: codegen, i18n, rust
- Language: Rust
- Homepage: https://baptiste0928.github.io/rosetta/
- Size: 1.1 MB
- Stars: 45
- Watchers: 2
- Forks: 2
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rosetta-i18n
[![Crates.io](https://img.shields.io/crates/v/rosetta-i18n)](https://crates.io/crates/rosetta-i18n)
[![dependency status](https://deps.rs/repo/github/baptiste0928/rosetta/status.svg)](https://deps.rs/repo/github/baptiste0928/rosetta)
[![docs.rs](https://img.shields.io/docsrs/rosetta-i18n)](https://docs.rs/rosetta-i18n/)
[![CI](https://github.com/baptiste0928/rosetta/actions/workflows/ci.yaml/badge.svg?event=push)](https://github.com/baptiste0928/rosetta/actions/workflows/ci.yaml)**rosetta-i18n** is an easy-to-use and opinionated Rust internationalization (i18n) library powered by code generation.
```rust
rosetta_i18n::include_translations!();println!(Lang::En.hello("world")); // Hello, world!
```**[Documentation](https://baptiste0928.github.io/rosetta/)**
## 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`:```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`](https://docs.rs/rosetta-i18n/)
and [`rosetta-build`](https://docs.rs/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.