Yamlization (y10n) is a simple translations management library in Rust.
Go to file
R Tyler Croy 877a3c95dd
Prepare Y10n for actual use
2021-07-05 09:23:18 -07:00
l10n Implement the basics of the Y10n structure and the merging of values 2021-07-05 08:56:08 -07:00
src Prepare Y10n for actual use 2021-07-05 09:23:18 -07:00
.gitignore initial commit 2021-07-04 13:23:46 -07:00
Cargo.toml Bring in some of the code from another project 2021-07-04 13:36:20 -07:00
LICENSE.txt Bring in some of the code from another project 2021-07-04 13:36:20 -07:00
README.adoc Prepare Y10n for actual use 2021-07-05 09:23:18 -07:00

README.adoc

<html lang="en"> <head> </head>

Yamlization

Yamlization (y10n) is a simple Rust-based localization (l10n) library. Strings can be defined in .yml files which are then merged together.

Typically y10n should be used with multiple translation files written in Yaml. The yaml files can be merged together to provide base translations (e.g. the English strings) underneath the users preferred language (such as German).

Example

en.yml
greeting: 'hello world'
de.yml
greeting: 'hallöchen kleiner Mann'
main.rs
use y10n::*;

fn main() {
    let y10n = Y10n::from_glob("l10n/**/*.yml");
    // Create Language entities based on an `Accept-Languages` header
    let langs = parse_accept_languages("en,de;q=0.5");
    let translations = y10n.localize(&langs);

    // Translations is a serde_yaml::Value which can easily be brought into
    // handlebars or other structures for interpolation
}
</html>