LibUnicode: Do not generate data for "generic" calendars

This is not a calendar supported by ECMA-402, so let's not waste space
with its data.

Further, don't generate "gregorian" as a valid Unicode locale extension
keyword. It's an invalid type identifier, thus cannot be used in locales
such as "en-u-ca-gregorian".
This commit is contained in:
Timothy Flynn 2021-11-30 21:23:13 -05:00 committed by Linus Groh
parent f02ecc1da2
commit bf79c73158
Notes: sideshowbarker 2024-07-17 23:15:28 +09:00
3 changed files with 18 additions and 13 deletions

View file

@ -407,12 +407,17 @@ static ErrorOr<void> parse_calendar_keywords(String locale_dates_path, UnicodeLo
auto const& calendars_object = dates_object.as_object().get("calendars"sv);
calendars_object.as_object().for_each_member([&](auto const& calendar_name, JsonValue const&) {
keyword_values.append(calendar_name);
// The generic calendar is not a supported Unicode calendar key, so skip it:
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/calendar#unicode_calendar_keys
if (calendar_name == "generic"sv)
return;
// FIXME: Similar to the calendar aliases defined in GenerateUnicodeDateTimeFormat, this
// should be parsed from BCP47. https://unicode-org.atlassian.net/browse/CLDR-15158
if (calendar_name == "gregorian"sv)
keyword_values.append("gregory"sv);
else
keyword_values.append(calendar_name);
});
}