locale-types

Crates.iolocale-types
lib.rslocale-types
version0.4.0
sourcesrc
created_at2019-08-26 16:41:57.860884
updated_at2019-08-27 16:26:36.809907
descriptionIdiomatic types for locale identifiers.
homepage
repositoryhttps://github.com/johnstonskj/locale-types.git
max_upload_size
id159824
size32,508
Simon Johnston (johnstonskj)

documentation

https://docs.rs/crate/locale-types

README

Crate locale-types

travis.ci crates.io docs.rs Minimum Rust Version mit License GitHub stars

This crate provides a Locale enumeration, LocaleIdentifier trait, and a LocaleString structure are provided that may be used to parse and construct locale identifiers in a standards-conformant manner.

It is used by the locale-codes and locale-settings crates.

Example

use locale_types::{LocaleIdentifier, LocaleString};

let locale = LocaleString::new("en".to_string()).unwrap()
    .with_territory("US".to_string()).unwrap()
    .with_code_set("UTF-8".to_string()).unwrap()
    .with_modifier("collation=pinyin;currency=CNY".to_string()).unwrap();
println!("{}", locale);

History

  • 0.4.0 - updated the interface LocaleIdentifier to return LocaleError on constructor errors.
  • 0.3.0 - updated module structure.
  • 0.1.0 - extracted from simple-locale.
Commit count: 22

cargo fmt