mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 14:55:08 +00:00
LibUnicode: Canonicalize the subtag "names" to "prprname"
This commit is contained in:
parent
f907a7dc38
commit
409f39b336
2 changed files with 10 additions and 1 deletions
|
@ -306,6 +306,8 @@ TEST_CASE(canonicalize_unicode_locale_id)
|
||||||
test("EN-U-KB-YES"sv, "en-u-kb"sv);
|
test("EN-U-KB-YES"sv, "en-u-kb"sv);
|
||||||
test("en-u-ka-yes"sv, "en-u-ka-yes"sv);
|
test("en-u-ka-yes"sv, "en-u-ka-yes"sv);
|
||||||
test("EN-U-KA-YES"sv, "en-u-ka-yes"sv);
|
test("EN-U-KA-YES"sv, "en-u-ka-yes"sv);
|
||||||
|
test("en-u-1k-names"sv, "en-u-1k-names"sv);
|
||||||
|
test("EN-U-1K-NAMES"sv, "en-u-1k-names"sv);
|
||||||
|
|
||||||
test("en-t-en"sv, "en-t-en"sv);
|
test("en-t-en"sv, "en-t-en"sv);
|
||||||
test("EN-T-EN"sv, "en-t-en"sv);
|
test("EN-T-EN"sv, "en-t-en"sv);
|
||||||
|
@ -321,6 +323,10 @@ TEST_CASE(canonicalize_unicode_locale_id)
|
||||||
test("EN-T-K1-TRUE"sv, "en-t-k1-true"sv);
|
test("EN-T-K1-TRUE"sv, "en-t-k1-true"sv);
|
||||||
test("en-t-k1-yes"sv, "en-t-k1-yes"sv);
|
test("en-t-k1-yes"sv, "en-t-k1-yes"sv);
|
||||||
test("EN-T-K1-YES"sv, "en-t-k1-yes"sv);
|
test("EN-T-K1-YES"sv, "en-t-k1-yes"sv);
|
||||||
|
test("en-t-m0-names"sv, "en-t-m0-prprname"sv);
|
||||||
|
test("EN-T-M0-NAMES"sv, "en-t-m0-prprname"sv);
|
||||||
|
test("en-t-k1-names"sv, "en-t-k1-names"sv);
|
||||||
|
test("EN-T-K1-NAMES"sv, "en-t-k1-names"sv);
|
||||||
|
|
||||||
test("en-0-aaa"sv, "en-0-aaa"sv);
|
test("en-0-aaa"sv, "en-0-aaa"sv);
|
||||||
test("EN-0-AAA"sv, "en-0-aaa"sv);
|
test("EN-0-AAA"sv, "en-0-aaa"sv);
|
||||||
|
|
|
@ -482,13 +482,16 @@ Optional<LocaleID> parse_unicode_locale_id(StringView locale)
|
||||||
|
|
||||||
static void perform_hard_coded_key_value_substitutions(String& key, String& value)
|
static void perform_hard_coded_key_value_substitutions(String& key, String& value)
|
||||||
{
|
{
|
||||||
// FIXME: In the XML export of CLDR, there are some aliases defined in the following file:
|
// 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/collation.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
|
// There doesn't seem to be a counterpart in the JSON export. Since there aren't many such
|
||||||
// aliases, until an XML parser is implemented, those aliases are implemented here.
|
// aliases, until an XML parser is implemented, those aliases are implemented here.
|
||||||
if (key.is_one_of("kb"sv, "kc"sv, "kh"sv, "kk"sv, "kn"sv) && (value == "yes"sv))
|
if (key.is_one_of("kb"sv, "kc"sv, "kh"sv, "kk"sv, "kn"sv) && (value == "yes"sv))
|
||||||
value = "true"sv;
|
value = "true"sv;
|
||||||
|
else if ((key == "m0"sv) && (value == "names"sv))
|
||||||
|
value = "prprname"sv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void transform_unicode_locale_id_to_canonical_syntax(LocaleID& locale_id)
|
static void transform_unicode_locale_id_to_canonical_syntax(LocaleID& locale_id)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue