unic-locale
is an API for managing Unicode Locale Identifiers.
The crate provides a way to create a struct from a string, manipulate its fields, canonicalize it, and serialize into a string.
```rust use std::convert::TryFrom;
use unic_locale::{Locale, ExtensionType};
let loc = Locale::try_from("en-US-u-hc-h12") .expect("Parsing.failed");
asserteq!(loc.getlanguage(), "en"); asserteq!(loc.getscript(), None); asserteq!(loc.getregion(), Some("US"));
loc.set_extension(ExtensionType::Unicode, "ca", "buddhist") .expect("Setting extension failed.");
asserteq!(&loc.tostring(), "en-US-u-ca-buddhist-hc-h12"); ```
The crate is providing fundamental blocks, but is very basic.
In particular, the supported extensions list is very limited and the ergonomics of manipulating them should be improved.
unic-locale
is open-source, licensed under the Apache License, Version 2.0. We
encourage everyone to take a look at our code and we'll listen to your
feedback.