summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2021-08-31 11:00:52 -0400
committerLinus Groh <mail@linusgroh.de>2021-09-01 14:14:47 +0100
commit2d901448883167e7ccaced960911c103d55544e3 (patch)
tree3ab0ffab62904bf1691f7ef0fb9a196e80fa94f5 /Userland
parent409f39b3362a1d84345624791dbee77cdc65428c (diff)
downloadserenity-2d901448883167e7ccaced960911c103d55544e3.zip
LibUnicode: Canonicalize the subtag "primary" and "tertiary" to "levelN"
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibUnicode/Locale.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/Userland/Libraries/LibUnicode/Locale.cpp b/Userland/Libraries/LibUnicode/Locale.cpp
index 46801a5783..db699778f0 100644
--- a/Userland/Libraries/LibUnicode/Locale.cpp
+++ b/Userland/Libraries/LibUnicode/Locale.cpp
@@ -488,10 +488,18 @@ static void perform_hard_coded_key_value_substitutions(String& key, String& valu
//
// 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.
- 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;
- else if ((key == "m0"sv) && (value == "names"sv))
+ } else if (key == "ks"sv) {
+ if (value == "primary"sv)
+ value = "level1"sv;
+ else if (value == "tertiary"sv)
+ value = "level3"sv;
+ // Note: There are also aliases for "secondary", "quaternary", "quarternary", and "identical",
+ // 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;
+ }
}
static void transform_unicode_locale_id_to_canonical_syntax(LocaleID& locale_id)