]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_baked_icu_data/src/lib.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / compiler / rustc_baked_icu_data / src / lib.rs
CommitLineData
487cf647
FG
1//! This crate contains pre-baked ICU4X data, generated by `icu4x-datagen`. The tool
2//! fetches locale data from CLDR and transforms them into const code in statics that
3//! ICU4X can load, via databake. `lib.rs` in this crate is manually written, but all
4//! other code is generated.
5//!
6//! This crate can be regenerated when there's a new CLDR version, though that is unlikely
7//! to result in changes in most cases (currently this only covers list formatting data, which
8//! is rather stable). It may need to be regenerated when updating ICU4X versions, especially
9//! across major versions, in case it fails to compile after an update.
10//!
11//! It must be regenerated when adding new locales to Rust, or if Rust's usage of ICU4X
12//! grows to need more kinds of data.
13//!
14//! To regenerate the data, run this command:
15//!
16//! ```text
17//! icu4x-datagen -W --pretty --fingerprint --use-separate-crates \
18//! --format mod -l en es fr it ja pt ru tr zh zh-Hans zh-Hant \
19//! -k list/and@1 fallback/likelysubtags@1 fallback/parents@1 fallback/supplement/co@1 \
20//! --cldr-tag latest --icuexport-tag latest -o src/data
21//! ```
22#![allow(elided_lifetimes_in_paths)]
23
24mod data {
25 include!("data/mod.rs");
26 include!("data/any.rs");
27}
28
29pub use data::BakedDataProvider;
30
31pub const fn baked_data_provider() -> BakedDataProvider {
32 data::BakedDataProvider
33}
34
35pub mod supported_locales {
36 pub const EN: icu_locid::Locale = icu_locid::locale!("en");
37 pub const ES: icu_locid::Locale = icu_locid::locale!("es");
38 pub const FR: icu_locid::Locale = icu_locid::locale!("fr");
39 pub const IT: icu_locid::Locale = icu_locid::locale!("it");
40 pub const JA: icu_locid::Locale = icu_locid::locale!("ja");
41 pub const PT: icu_locid::Locale = icu_locid::locale!("pt");
42 pub const RU: icu_locid::Locale = icu_locid::locale!("ru");
43 pub const TR: icu_locid::Locale = icu_locid::locale!("tr");
44 pub const ZH_HANS: icu_locid::Locale = icu_locid::locale!("zh-Hans");
45 pub const ZH_HANT: icu_locid::Locale = icu_locid::locale!("zh-Hant");
46}