#localization #projects #language

no-std localizer

Simple library for localization

4 releases

0.3.5 Apr 7, 2021
0.3.0 Oct 31, 2020
0.2.4 Aug 26, 2020
0.2.3 Aug 22, 2020

#186 in Internationalization (i18n)

MIT license

33KB
804 lines

Localizer

[dependencies]
 localizer= "0.3.0"

Simple library for localization used in rust projects.

Current Crates.io Version Document

Examples:

cargo run --example %example%

1: ex1

2: ex2

3:

Tic_Tac_Toe game1 Tic_Tac_Toe game2

No-Std:

feature = "no_std"

Cargo.toml:

localizer = {version = ..., default-features = false, features = ["no_std"]}


lib.rs:

Simple library for localization. Current Crates.io Version Document

no unsafe code

Example:

use localizer::*;
const langs_file : &str = "
[langs.ru]
\"ex1\" = \"ПРН{}\"

[langs.en]
\"ex1\" = \"IKA{}\"";
localizer::set_loc_string(langs_file);
//localizator::set_localizer(Localizer::create().file(None).current_lang(Some("ru".to_string())));
localizer::change_localizer(&|x|{x.set_current_lang(Some("ru".to_string()));});
println!("{:?}", localizer::get_by_key(&"ex1"));
let loc = Localizer::create().file(None).current_lang(Some("ru".to_string()));
println!("{:?}", loc.get(&"ex1"));

Further examples:

cargo run --example %example%

1:

ex1

2:

ex2

3:

Tic_Tac_Toe game1 Tic_Tac_Toe game2

No-Std:

feature = "no_std"

Cargo.toml:

localizer = {version = ..., default-features = false, features = ["no_std"]}

Dependencies

~135–485KB