Skip to content

Should LocaleDirectionality::get perform full Add-Likely-Subtags algorithm? #7866

@anba

Description

@anba

LocaleDirectionality doesn't add likely subtags to und in all cases. Is this expected? I've interpreted Marcus' comment in #3172 (comment) that a missing script subtag is added by performing the Add-Likely-Subtags algorithm and this is also what then got spec'ed into ECMA402's TextDirectionOfLocale.

This test case prints Some(RightToLeft) for und-SA, but None for und-US.

use icu_locale::LocaleDirectionality;
use icu_locale::langid;

fn main() {
  let ld = LocaleDirectionality::new_extended();
  dbg!(ld.get(&langid!("und-SA")));
  dbg!(ld.get(&langid!("und-US")));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-localeComponent: Locale identifiers, BCP47

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions