These parameters are now generated inside the function body - not ideal, but better than before. They could be cached in some global data structure to fix this long-term.
P6FW2GGOW24UZZAWQ6IDDI66JBWTIY26TATMCIOETZ4GRRGGUI3AC
4MRF5E76QSW3EPICI6TNEGJ2KSBWODWMIDQPLYALDWBYWKAV5LJAC
5FIVUZYFLOZ2CCH4GCOQQZFL3GDEB23VJ7J6YUXQDZQEAQDB76DQC
XGNME3WRU3MJDTFHUFJYARLVXWBZIH5ODBOIIFTXHNCBTZQH2R7QC
BQ6N55O7RPG47G35YI37Z37456VKWT5KLGQKDQVAN2WI4K34TRBQC
5TEX4MNUC4LDDRMNEOVCFNUUEZAGUXMKO3OIEQFXWRQKXSHY2NRQC
XEEXWJLGVIPIGURSDU4ETZMGAIFTFDPECM4QWFOSRHU7GMGVOUVQC
3WEPY3OXJJ72TNVZLFCN2ZDWSADLT52T6DUONFGEAB46UWAQD3PQC
SHNZZSZGIBTTD4IV5SMW5BIN5DORUWQVTVTNB5RMRD5CTFNOMJ6AC
fn localize(&self, locales: &[&::icu_locid::Locale], plural_rules: &::icu_plurals::PluralRules) -> String {
// Check each locale to see if it's implemented for this message
for locale in locales {
match self {
#(Self::#idents => #extra_messages),*
}
}
fn localize(&self) -> String {
// Find the appropriate locale to use
let extra_locales = [#(::icu_locid::langid!(#extra_locales)),*];
let canonical_locale = ::icu_locid::langid!(#canonical_locale);
let locale = ::locale_select::match_locales(&extra_locales, &canonical_locale);
// TODO: this shouldn't be generated on every call
// TODO: handle different rule types according to fluent code (not just cardinal)
let plural_rule_type = ::icu_plurals::PluralRuleType::Cardinal;
let plural_rules = ::icu_plurals::PluralRules::try_new(&locale.clone().into(), plural_rule_type).unwrap();
pub fn canonical_message(&self, id: &str) -> syn::Expr {
let message_column = self
.canonical_messages
.iter()
.position(|message| message.id.name == id)
.expect("Message id must be valid");
crate::parse_fluent::message(&self.canonical_messages[message_column])
pub fn canonical_locale(&self) -> &Locale {
&self.canonical_locale
}
pub fn extra_locales(&self) -> impl Iterator<Item = &Locale> {
self.extra_locales.iter().map(| LocaleGroup { locale, .. }| locale)
locale_select = { path = "../locale_select" }