Crate l20n

Source
👎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§

LocaleDeprecated
A Locale contains all the resources for a specific language.
ParseErrorDeprecated
An error occurred trying to parse an L20n resource. The L20n file is invalid.

Enums§

EncodeErrorDeprecated
Errors that occur encoding environment data into something the L20n resources can use.
LocalizeErrorDeprecated
An enum of the various errors that can occur during localization.
ParseErrorKindDeprecated
The description of the ParseError that occurred.
ResolveErrorDeprecated
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§

LocalizeResultDeprecated
A Result of trying to localize.