This crate provides locale-related codes/identifiers and any standards-based information
concerning them. For example, ISO-396 language identifiers, or ISO-3166
country identifiers. These are under the module simple_locale::codes
.
```rust use localetypes::{LocaleIdentifier::LocaleString}; use localecodes::codes::{country, currency, region};
let locale = LocaleString::newstrict("en".tostring()) .withterritory("US".tostring()) .withcodeset("UTF-8".tostring()) .withmodifier("collation=pinyin;currency=CNY".to_string()); println!("{}", locale);
let mexico = country::lookup_country("MEX").unwrap(); println!("{:?}", mexico);
let mexicoregion = country::lookupregion(mexico.countrycode).unwrap(); println!("{:?}", mexicoregion);
let currencies = currency::currenciesforcountryname(mexicoregion.name.as_str()); println!("{:?}", currencies); ```
The following describe two code generation steps that are executed outside the normal build process as the output is stored in Git and versioned based on external factors.
The script create-data-modules
on the other hand is used to process files downloaded, or scraped, from
standards web sites to create data used by the library. This data is generated
as JSON files in the src/codes/data
folder and read as a part of the
build for codes
modules using the Rust include!
macro.
Currently data is generated for the following standards:
codes
and settings
crates.