icu4x
icu4x copied to clipboard
Support u-rg in region priority fallback (and u-sd)
There is a comment in the fallback code:
// NOTE: -u-rg is not yet supported; when it is, this test should be updated
I think -u-rg should be supported in region priority fallback.
Should probably consult with the CLDR design group.
We really should support -u-rg; it's not a low priority feature. It directly impacts i18n correctness.
One way to support both this and -u-sd would be for LocaleFallbacker to take all of these things as parameters and store them in internal slots, similar to how it currently deals with variants. It can still emit LanguageIdentifiers.
@robertbastian
So for -u-rg I think we can still emit LanguageIdentifer but it's not clear to me how we'd do that for -u-sd unless we changed the data model.
Ideally we should support something like
pub struct DataLocale {
pub language: Language,
pub script: Option<Script>,
pub region: Option<Region>,
pub sd_only: Option<SubdivisionOnly>,
pub variant: Option<Variant>,
}
pub struct SubdivisionOnly(TinyStr6)
and then you'd get strings like
en-USen-US-ca