3 releases (breaking)

0.4.0 Aug 27, 2019
0.3.0 Aug 26, 2019
0.1.0 Aug 26, 2019

#207 in Internationalization (i18n)

Download history 73/week @ 2024-03-13 154/week @ 2024-03-20 192/week @ 2024-03-27 221/week @ 2024-04-03 186/week @ 2024-04-10 182/week @ 2024-04-17 93/week @ 2024-04-24 38/week @ 2024-05-01 145/week @ 2024-05-08 144/week @ 2024-05-15 137/week @ 2024-05-22 134/week @ 2024-05-29 135/week @ 2024-06-05 159/week @ 2024-06-12 178/week @ 2024-06-19 138/week @ 2024-06-26

631 downloads per month
Used in 3 crates

MIT license

30KB
482 lines

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.

Dependencies

~2.1–3MB
~53K SLoC