Currently a simple re-export of runtime dependencies and Localize trait, which should be extended to have default implementations for dates/times, file sizes etc.
HHJDRLLNN36UNIA7STAXEEVBCEMPJNB7SJQOS3TJLLYN4AEZ4MHQC QFPQZR4K4UZ7R2GQZJG4NYBGVQJVL2ANIKGGTOHAMIRIBQHPSQGAC KDUI7LHJRRQRFYPY7ANUNXG6XCUKQ4YYOEL5NG5Y6BRMV6GQ5M7AC NO3PDO7PY7J3WPADNCS5VD6HKFY63E23I3SDR4DHXNVQJTG27RAAC O77KA6C4UJGZXVGPEA7WCRQH6XYQJPWETSPDXI3VOKOSRQND7JEQC V5S5K33ALIEG5ZABUSAPO4ULHEBFDB2PLTW27A4BFS342SJG7URQC 5TEX4MNUC4LDDRMNEOVCFNUUEZAGUXMKO3OIEQFXWRQKXSHY2NRQC F5LG7WENUUDRSCTDMA4M6BAC5RWTGQO45C4ZEBZDX6FHCTTHBVGQC XGNME3WRU3MJDTFHUFJYARLVXWBZIH5ODBOIIFTXHNCBTZQH2R7QC P6FW2GGOW24UZZAWQ6IDDI66JBWTIY26TATMCIOETZ4GRRGGUI3AC 4MRF5E76QSW3EPICI6TNEGJ2KSBWODWMIDQPLYALDWBYWKAV5LJAC XEEXWJLGVIPIGURSDU4ETZMGAIFTFDPECM4QWFOSRHU7GMGVOUVQC SHNZZSZGIBTTD4IV5SMW5BIN5DORUWQVTVTNB5RMRD5CTFNOMJ6AC VZYZRAO4EXCHW2LBVFG5ELSWG5SCNDREMJ6RKQ4EKQGI2T7SD3ZQC YNEOCYMGMSHQGCL5TOIGWDDKHE4BZ5M7FGY5I6B2V6JO6ZRCLETAC UKFEFT6LSI4K7X6UHQFZYD52DILKXMZMYSO2UYS2FCHNPXIF4BEQC WBI5HFOBBUMDSGKY2RX3YA6N7YDCJEP23JNEJ7PG5VZXHLYIRJRQC VNSHGQYNPGKGGPYNVP4Z2RWD7JCSDJVYAADD6UXWBYL6ZRXKLE4AC JZXXFWQKOYAFQLQZDRALXG4KGEDR7JKO3AZ5Q5X7IQTS7BCJP3QAC use icu_provider::DataLocale;// Public re-exports of dependencies required at runtime, so macro-generated code// can find all the dependencies it expects as long as this crate existspub use icu_locid::{self, langid, LanguageIdentifier};pub use icu_plurals::{self, PluralRuleType, PluralRules};pub use locale_select;pub trait Localize {const CANONICAL_LOCALE: LanguageIdentifier;fn localize(&self) -> String;}/// Select which locale to use, falling back to the canonical locale if nothing matchespub fn select_locale(available_locales: &[LanguageIdentifier],canonical_locale: &LanguageIdentifier,) -> LanguageIdentifier {locale_select::match_locales(available_locales, canonical_locale)}pub fn plural_rules(locale: &LanguageIdentifier,rule_type: PluralRuleType,) -> Result<PluralRules, icu_plurals::Error> {let data_locale = DataLocale::from(locale);PluralRules::try_new(&data_locale, rule_type)}
[package]name = "fluent_embed_runtime"version = "0.1.0"edition = "2021"[lints]workspace = true[dependencies]icu_locid = "1.4.0"icu_plurals = "1.4.0"icu_provider = "1.4.0"locale_select = { path = "../locale_select" }
impl #ident {// TODO: most of this shouldn't be generated on every call
impl ::fluent_embed_runtime::Localize for #ident {const CANONICAL_LOCALE: ::fluent_embed_runtime::icu_locid::LanguageIdentifier =::fluent_embed_runtime::icu_locid::langid!(#canonical_locale);
// Find the appropriate locale to uselet additional_locales = [#(::icu_locid::langid!(#additional_locales)),*];let canonical_locale = ::icu_locid::langid!(#canonical_locale);let locale = ::locale_select::match_locales(&additional_locales, &canonical_locale);
// Create a list of available locales to choose fromlet available_locales = [// The canonical locale will always be availableSelf::CANONICAL_LOCALE,// Any additional locales that contain this message#(::fluent_embed_runtime::langid!(#additional_locales)),*];let locale = ::fluent_embed_runtime::select_locale(&available_locales, &Self::CANONICAL_LOCALE);
let plural_rule_type = ::icu_plurals::PluralRuleType::Cardinal;let plural_rules = ::icu_plurals::PluralRules::try_new(&locale.clone().into(), plural_rule_type).unwrap();
// TODO: only generate this when needed in messageconst plural_rule_type: ::fluent_embed_runtime::PluralRuleType =::fluent_embed_runtime::PluralRuleType::Cardinal;let plural_rules = ::fluent_embed_runtime::plural_rules(&locale, plural_rule_type).unwrap();