diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:25 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:18:25 +0000 |
commit | 5363f350887b1e5b5dd21a86f88c8af9d7fea6da (patch) | |
tree | 35ca005eb6e0e9a1ba3bb5dbc033209ad445dc17 /compiler/rustc_baked_icu_data/src/lib.rs | |
parent | Adding debian version 1.66.0+dfsg1-1. (diff) | |
download | rustc-5363f350887b1e5b5dd21a86f88c8af9d7fea6da.tar.xz rustc-5363f350887b1e5b5dd21a86f88c8af9d7fea6da.zip |
Merging upstream version 1.67.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_baked_icu_data/src/lib.rs')
-rw-r--r-- | compiler/rustc_baked_icu_data/src/lib.rs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/compiler/rustc_baked_icu_data/src/lib.rs b/compiler/rustc_baked_icu_data/src/lib.rs new file mode 100644 index 000000000..4651e03f7 --- /dev/null +++ b/compiler/rustc_baked_icu_data/src/lib.rs @@ -0,0 +1,46 @@ +//! This crate contains pre-baked ICU4X data, generated by `icu4x-datagen`. The tool +//! fetches locale data from CLDR and transforms them into const code in statics that +//! ICU4X can load, via databake. `lib.rs` in this crate is manually written, but all +//! other code is generated. +//! +//! This crate can be regenerated when there's a new CLDR version, though that is unlikely +//! to result in changes in most cases (currently this only covers list formatting data, which +//! is rather stable). It may need to be regenerated when updating ICU4X versions, especially +//! across major versions, in case it fails to compile after an update. +//! +//! It must be regenerated when adding new locales to Rust, or if Rust's usage of ICU4X +//! grows to need more kinds of data. +//! +//! To regenerate the data, run this command: +//! +//! ```text +//! icu4x-datagen -W --pretty --fingerprint --use-separate-crates \ +//! --format mod -l en es fr it ja pt ru tr zh zh-Hans zh-Hant \ +//! -k list/and@1 fallback/likelysubtags@1 fallback/parents@1 fallback/supplement/co@1 \ +//! --cldr-tag latest --icuexport-tag latest -o src/data +//! ``` +#![allow(elided_lifetimes_in_paths)] + +mod data { + include!("data/mod.rs"); + include!("data/any.rs"); +} + +pub use data::BakedDataProvider; + +pub const fn baked_data_provider() -> BakedDataProvider { + data::BakedDataProvider +} + +pub mod supported_locales { + pub const EN: icu_locid::Locale = icu_locid::locale!("en"); + pub const ES: icu_locid::Locale = icu_locid::locale!("es"); + pub const FR: icu_locid::Locale = icu_locid::locale!("fr"); + pub const IT: icu_locid::Locale = icu_locid::locale!("it"); + pub const JA: icu_locid::Locale = icu_locid::locale!("ja"); + pub const PT: icu_locid::Locale = icu_locid::locale!("pt"); + pub const RU: icu_locid::Locale = icu_locid::locale!("ru"); + pub const TR: icu_locid::Locale = icu_locid::locale!("tr"); + pub const ZH_HANS: icu_locid::Locale = icu_locid::locale!("zh-Hans"); + pub const ZH_HANT: icu_locid::Locale = icu_locid::locale!("zh-Hant"); +} |