summaryrefslogtreecommitdiff
path: root/Meta/Lagom/Tools
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-01-29 10:59:59 -0500
committerLinus Groh <mail@linusgroh.de>2022-01-29 20:27:24 +0000
commit4d43aeae30f96a034be0e8a5f8a520b26355d674 (patch)
tree7767155e7e9b7d32b8e461dec58a3700573d1573 /Meta/Lagom/Tools
parent2ad38102f5025c888df3071dcea5a178dbedfbba (diff)
downloadserenity-4d43aeae30f96a034be0e8a5f8a520b26355d674.zip
LibUnicode: Fill in case-first and numeric BCP47 keywords
Unlike other BCP47 keywords that we are parsing, these only appear in the BCP47 XML file itself within the CLDR. The values are very simple though, so just hard code them until the Unicode org re-releases the CLDR with BCP47: https://unicode-org.atlassian.net/browse/CLDR-15158
Diffstat (limited to 'Meta/Lagom/Tools')
-rw-r--r--Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp
index 0457d44d18..8369ce8169 100644
--- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp
+++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp
@@ -215,7 +215,7 @@ struct UnicodeLocaleData {
{ "week"sv, "weekOfYear"sv },
{ "zone"sv, "timeZoneName"sv },
};
- Vector<String> keywords { "ca"sv, "nu"sv }; // FIXME: These should be parsed from BCP47. https://unicode-org.atlassian.net/browse/CLDR-15158
+ Vector<String> keywords { "ca"sv, "kf"sv, "kn"sv, "nu"sv }; // FIXME: These should be parsed from BCP47. https://unicode-org.atlassian.net/browse/CLDR-15158
Vector<String> list_pattern_types;
HashMap<String, StringIndexType> language_aliases;
HashMap<String, StringIndexType> territory_aliases;
@@ -743,6 +743,17 @@ static ErrorOr<void> parse_calendar_keywords(String locale_dates_path, UnicodeLo
return {};
}
+static void fill_in_bcp47_keywords(UnicodeLocaleData& locale_data, KeywordList& keywords)
+{
+ // FIXME: These should be parsed from BCP47. They are only available in this XML file:
+ // https://github.com/unicode-org/cldr/blob/main/common/bcp47/collation.xml
+ auto kf_index = locale_data.keywords.find_first_index("kf"sv).value();
+ keywords[kf_index] = locale_data.unique_strings.ensure("upper,lower,false"sv);
+
+ auto kn_index = locale_data.keywords.find_first_index("kn"sv).value();
+ keywords[kn_index] = locale_data.unique_strings.ensure("true,false"sv);
+}
+
static ErrorOr<void> parse_default_content_locales(String core_path, UnicodeLocaleData& locale_data)
{
LexicalPath default_content_path(move(core_path));
@@ -902,6 +913,7 @@ static ErrorOr<void> parse_all_locales(String core_path, String locale_names_pat
auto& keywords = ensure_keyword_list(language);
TRY(parse_numeric_keywords(numbers_path, locale_data, keywords));
+ fill_in_bcp47_keywords(locale_data, keywords);
}
while (dates_iterator.has_next()) {