LibUnicode: Canonicalize the subtag "imperial" to "uksystem"

This commit is contained in:
Timothy Flynn 2021-08-31 11:12:03 -04:00 committed by Linus Groh
parent 2d90144888
commit 335f985b31
Notes: sideshowbarker 2024-07-18 04:57:27 +09:00
2 changed files with 9 additions and 0 deletions

View file

@ -312,6 +312,10 @@ TEST_CASE(canonicalize_unicode_locale_id)
test("EN-U-KS-PRIMARY"sv, "en-u-ks-level1"sv);
test("en-u-ka-primary"sv, "en-u-ka-primary"sv);
test("EN-U-KA-PRIMARY"sv, "en-u-ka-primary"sv);
test("en-u-ms-imperial"sv, "en-u-ms-uksystem"sv);
test("EN-U-MS-IMPERIAL"sv, "en-u-ms-uksystem"sv);
test("en-u-ma-imperial"sv, "en-u-ma-imperial"sv);
test("EN-U-MA-IMPERIAL"sv, "en-u-ma-imperial"sv);
test("en-t-en"sv, "en-t-en"sv);
test("EN-T-EN"sv, "en-t-en"sv);
@ -333,6 +337,8 @@ TEST_CASE(canonicalize_unicode_locale_id)
test("EN-T-K1-NAMES"sv, "en-t-k1-names"sv);
test("en-t-k1-primary"sv, "en-t-k1-primary"sv);
test("EN-T-K1-PRIMARY"sv, "en-t-k1-primary"sv);
test("en-t-k1-imperial"sv, "en-t-k1-imperial"sv);
test("EN-T-K1-IMPERIAL"sv, "en-t-k1-imperial"sv);
test("en-0-aaa"sv, "en-0-aaa"sv);
test("EN-0-AAA"sv, "en-0-aaa"sv);

View file

@ -484,6 +484,7 @@ static void perform_hard_coded_key_value_substitutions(String& key, String& valu
{
// FIXME: In the XML export of CLDR, there are some aliases defined in the following files:
// https://github.com/unicode-org/cldr-staging/blob/master/production/common/bcp47/collation.xml
// https://github.com/unicode-org/cldr-staging/blob/master/production/common/bcp47/measure.xml
// https://github.com/unicode-org/cldr-staging/blob/master/production/common/bcp47/transform.xml
//
// There doesn't seem to be a counterpart in the JSON export. Since there aren't many such
@ -499,6 +500,8 @@ static void perform_hard_coded_key_value_substitutions(String& key, String& valu
// but those are semantically incorrect values (they are too long), so they can be skipped.
} else if ((key == "m0"sv) && (value == "names"sv)) {
value = "prprname"sv;
} else if ((key == "ms"sv) && (value == "imperial"sv)) {
value = "uksystem"sv;
}
}