localizer/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2//!Simple library for localization.
3
4//! [![Current Crates.io Version](https://img.shields.io/crates/v/localizer.svg)](https://crates.io/crates/localizer)
5//! [![Document](https://img.shields.io/badge/doc-localizer-green.svg)](https://docs.rs/localizer)
6//! # no unsafe code
7//! # Example:
8//! ```
9//! use localizer::*;
10//! const langs_file : &str = "
11//! [langs.ru]
12//! \"ex1\" = \"ПРН{}\"
13//!
14//! [langs.en]
15//! \"ex1\" = \"IKA{}\"";
16//! localizer::set_loc_string(langs_file);
17//! //localizator::set_localizer(Localizer::create().file(None).current_lang(Some("ru".to_string())));
18//! localizer::change_localizer(&|x|{x.set_current_lang(Some("ru".to_string()));});
19//! println!("{:?}", localizer::get_by_key(&"ex1"));
20//! let loc = Localizer::create().file(None).current_lang(Some("ru".to_string()));
21//! println!("{:?}", loc.get(&"ex1"));
22//! ```
23//! 
24//! 
25//! # Further examples:
26//! > cargo run --example %example%
27//! ## 1:
28//! [ex1](https://github.com/PSL9902/localizer/blob/master/examples/ex1.rs)
29//! ## 2:
30//! [ex2](https://github.com/PSL9902/localizer/blob/master/examples/ex2.rs)
31//! ## 3:
32//! [Tic_Tac_Toe game1](https://github.com/PSL9902/localizer/blob/master/examples/tic-tac-toe.rs)
33//! [Tic_Tac_Toe game2](https://github.com/PSL9902/rust_Tic_Tac_Toe/tree/master)
34//! # No-Std:
35//! > feature = "no_std"
36//! ## Cargo.toml:
37//! > localizer = {version = ..., default-features = false, features = ["no_std"]}
38
39
40
41pub mod constants;
42
43pub mod structs;
44pub use structs::localizer::Localizer;
45
46pub mod enums;
47
48pub mod prelude;
49pub use prelude::*;
50
51pub mod error;
52pub use error::Error;
53
54#[cfg(feature = "format")]
55pub mod formatter;
56//#[cfg(feature = "format")]
57//pub use form::*;
58
59pub mod traits;
60pub use traits::{FnUser};
61
62impl<T> traits::FnUser for T {}
63
64//#[cfg(not(feature = "no_std"))]
65//use enums::standart::res_keeper;