Crates.io | locale-codes |
lib.rs | locale-codes |
version | 0.3.0 |
source | src |
created_at | 2019-08-26 17:12:25.248004 |
updated_at | 2019-08-26 18:27:25.856925 |
description | locale-related codes/identifiers and any standards-based information concerning them. |
homepage | |
repository | https://github.com/johnstonskj/locale-codes.git |
max_upload_size | |
id | 159829 |
size | 2,356,484 |
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.
use locale_codes::codes::{country, currency, region};
let mexico = country::lookup_country("MEX").unwrap();
println!("{:?}", mexico);
let mexico_region = country::lookup_region(mexico.country_code).unwrap();
println!("{:?}", mexico_region);
let currencies = currency::currencies_for_country_name(mexico_region.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.