You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
2 years ago | |
---|---|---|
l10n | 2 years ago | |
src | 2 years ago | |
.gitignore | 2 years ago | |
Cargo.toml | 2 years ago | |
LICENSE.txt | 2 years ago | |
README.adoc | 2 years ago |
README.adoc
<html lang="en">
<head>
</head>
</html>
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
}