icu4x icon indicating copy to clipboard operation
icu4x copied to clipboard

Support u-rg in region priority fallback (and u-sd)

Open sffc opened this issue 2 years ago • 2 comments

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.

sffc avatar Dec 06 '23 19:12 sffc

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

sffc avatar Jun 03 '24 16:06 sffc

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-US
  • en-US-ca

sffc avatar Jun 03 '24 17:06 sffc