unic-locale
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.
Usage
use ;
let loc: Locale = "en-US-u-hc-h12".parse
.expect;
assert_eq!;
assert_eq!;
assert_eq!;
loc.extensions.unicode.set_keyword
.expect;
assert_eq!;
Macros
unic-locale
can be also compiled with features = ["macros"]
which enables locale!
macro:
use locale;
let loc = locale!;
assert_eq!
The macro allows for compile-time parsing and validation of literal locale identifiers.
Status
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.
Get Involved
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.