👎Deprecated: Look at https://github.com/projectfluent/fluent-rs instead.
Expand description
L20n implementation for localization
This crate provides an interface to use l20n files to localize your application.
§Example usage
extern crate l20n;
use std::collections::HashMap;
fn main() {
let mut locale = l20n::Locale::new();
locale.add_resource(r#"
<hi "Hello {{ $name }}!">
"#).unwrap();
let mut env = HashMap::new();
env.insert("name", "Rust");
let strs: HashMap<String, String> = locale.localize_data(env).unwrap();
assert_eq!(strs["hi"], "Hello Rust!");
}
Structs§
- Locale
Deprecated - A Locale contains all the resources for a specific language.
- Parse
Error Deprecated - An error occurred trying to parse an L20n resource. The L20n file is invalid.
Enums§
- Encode
Error Deprecated - Errors that occur encoding environment data into something the L20n resources can use.
- Localize
Error Deprecated - An enum of the various errors that can occur during localization.
- Parse
Error Kind Deprecated - The description of the ParseError that occurred.
- Resolve
Error Deprecated - Errors that can occur when resolving a set of l20n resources into strings. These errors are cause by problems in the l20n file, or incorrect Data provided when localizing.
Type Aliases§
- Localize
Result Deprecated - A Result of trying to localize.