3 releases (breaking)

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

#324 in Internationalization (i18n)

Download history 27/week @ 2023-11-20 14/week @ 2023-11-27 7/week @ 2023-12-04 80/week @ 2023-12-11 86/week @ 2023-12-18 82/week @ 2023-12-25 167/week @ 2024-01-01 189/week @ 2024-01-08 295/week @ 2024-01-15 108/week @ 2024-01-22 116/week @ 2024-01-29 113/week @ 2024-02-05 116/week @ 2024-02-12 110/week @ 2024-02-19 112/week @ 2024-02-26 97/week @ 2024-03-04

448 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.2–3MB
~54K SLoC