Crate l20n [] [src]

Deprecated

: Look at https://github.com/projectfluent/fluent-rs instead.

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.

ParseError [
Deprecated
]

An error occurred trying to parse an L20n resource. The L20n file is invalid.

Enums

EncodeError [
Deprecated
]

Errors that occur encoding environment data into something the L20n resources can use.

LocalizeError [
Deprecated
]

An enum of the various errors that can occur during localization.

ParseErrorKind [
Deprecated
]

The description of the ParseError that occurred.

ResolveError [
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 Definitions

LocalizeResult [
Deprecated
]

A Result of trying to localize.