embedded_lang/
lib.rs

1//! A small library to provide translation strings as an embedded resource
2//! Language files are in JSON format and will be embedded into the binary at compile time.
3//!
4//! Please see the examples directory for language file samples
5//!
6//! Usage example:
7//! ```rust
8//! use embedded_lang::{ LanguageSet, embedded_language };
9//!
10//! fn main() {
11//!     let mut translator = LanguageSet::new("fr", &[
12//!         embedded_language!("../examples/en.lang.json"),
13//!         embedded_language!("../examples/fr.lang.json"),
14//!     ]);
15//!     translator.set_fallback_language("en");
16//!
17//!     assert_eq!(translator["tree"], "arbre".to_string());
18//! }
19//! ```
20//!
21//! LanguageSets have a current language, and a fallback language from which strings will be fetched
22//! if the current language is missing the requested string.
23#![doc(html_root_url = "https://docs.rs/embedded-lang/0.9.0")]
24#![warn(missing_docs)]
25
26mod language;
27mod language_set;
28mod macros;
29
30pub use language::*;
31pub use language_set::*;
32pub use macros::*;
33
34#[cfg(test)]
35mod test_token {
36    #[test]
37    fn test_readme_deps() {
38        version_sync::assert_markdown_deps_updated!("README.md");
39    }
40
41    #[test]
42    fn test_html_root_url() {
43        version_sync::assert_html_root_url_updated!("src/lib.rs");
44    }
45}