From 4d43aeae30f96a034be0e8a5f8a520b26355d674 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Sat, 29 Jan 2022 10:59:59 -0500 Subject: 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 --- .../CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'Meta/Lagom') 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 keywords { "ca"sv, "nu"sv }; // FIXME: These should be parsed from BCP47. https://unicode-org.atlassian.net/browse/CLDR-15158 + Vector 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 list_pattern_types; HashMap language_aliases; HashMap territory_aliases; @@ -743,6 +743,17 @@ static ErrorOr 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 parse_default_content_locales(String core_path, UnicodeLocaleData& locale_data) { LexicalPath default_content_path(move(core_path)); @@ -902,6 +913,7 @@ static ErrorOr 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()) { -- cgit v1.2.3