diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeDateTimeFormat.cpp b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeDateTimeFormat.cpp index f6aa97759a..b6f3124d60 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeDateTimeFormat.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeDateTimeFormat.cpp @@ -1855,8 +1855,6 @@ struct DayPeriodData { }; )~~~"); - generate_available_values(generator, "get_available_calendars"sv, locale_data.calendars, locale_data.calendar_aliases); - locale_data.unique_formats.generate(generator, "CalendarFormatImpl"sv, "s_calendar_formats"sv, 10); locale_data.unique_symbol_lists.generate(generator, s_string_index_type, "s_symbol_lists"sv); locale_data.unique_calendar_symbols.generate(generator, "CalendarSymbols"sv, "s_calendar_symbols"sv, 10); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp index 82e24ff7be..80dd3b0e2c 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeLocale.cpp @@ -1054,6 +1054,8 @@ struct Patterns { }; )~~~"); + generate_available_values(generator, "get_available_calendars"sv, locale_data.keywords.find("ca"sv)->value, locale_data.keyword_aliases.find("ca"sv)->value); + generate_available_values(generator, "get_available_number_systems"sv, locale_data.keywords.find("nu"sv)->value, locale_data.keyword_aliases.find("nu"sv)->value); generate_available_values(generator, "get_available_currencies"sv, locale_data.currencies); locale_data.unique_display_patterns.generate(generator, "DisplayPatternImpl"sv, "s_display_patterns"sv, 30); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeNumberFormat.cpp b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeNumberFormat.cpp index 66648210e0..f9d0d4f537 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeNumberFormat.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeNumberFormat.cpp @@ -865,8 +865,6 @@ struct Unit { }; )~~~"); - generate_available_values(generator, "get_available_number_systems"sv, locale_data.number_systems); - locale_data.unique_formats.generate(generator, "NumberFormatImpl"sv, "s_number_formats"sv, 10); locale_data.unique_format_lists.generate(generator, s_number_format_index_type, "s_number_format_lists"sv); locale_data.unique_symbols.generate(generator, s_string_index_type, "s_numeric_symbol_lists"sv); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h index 69a06a08d6..a3329f60e6 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h +++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h @@ -533,8 +533,8 @@ Span @name@() generator.append(first ? " " : ", "); first = false; - if (auto it = aliases.find_if([&](auto const& alias) { return alias.name == value; }); it != aliases.end()) - generator.append(String::formatted("\"{}\"sv", it->alias)); + if (auto it = aliases.find_if([&](auto const& alias) { return alias.alias == value; }); it != aliases.end()) + generator.append(String::formatted("\"{}\"sv", it->name)); else generator.append(String::formatted("\"{}\"sv", value)); } diff --git a/Userland/Libraries/LibUnicode/DateTimeFormat.cpp b/Userland/Libraries/LibUnicode/DateTimeFormat.cpp index dda00c4a0f..6ec47d101d 100644 --- a/Userland/Libraries/LibUnicode/DateTimeFormat.cpp +++ b/Userland/Libraries/LibUnicode/DateTimeFormat.cpp @@ -93,7 +93,6 @@ StringView calendar_pattern_style_to_string(CalendarPatternStyle style) Optional __attribute__((weak)) calendar_from_string(StringView) { return {}; } Optional __attribute__((weak)) hour_cycle_region_from_string(StringView) { return {}; } -Span __attribute__((weak)) get_available_calendars() { return {}; } Vector __attribute__((weak)) get_regional_hour_cycles(StringView) { return {}; } // https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table diff --git a/Userland/Libraries/LibUnicode/DateTimeFormat.h b/Userland/Libraries/LibUnicode/DateTimeFormat.h index 1badc16219..92343fa5ef 100644 --- a/Userland/Libraries/LibUnicode/DateTimeFormat.h +++ b/Userland/Libraries/LibUnicode/DateTimeFormat.h @@ -189,8 +189,6 @@ StringView calendar_pattern_style_to_string(CalendarPatternStyle style); Optional calendar_from_string(StringView calendar); Optional hour_cycle_region_from_string(StringView hour_cycle_region); -Span get_available_calendars(); - Vector get_regional_hour_cycles(StringView region); Vector get_locale_hour_cycles(StringView locale); Optional get_default_regional_hour_cycle(StringView locale); diff --git a/Userland/Libraries/LibUnicode/Locale.cpp b/Userland/Libraries/LibUnicode/Locale.cpp index 71b7c11912..a9e9ba3e8b 100644 --- a/Userland/Libraries/LibUnicode/Locale.cpp +++ b/Userland/Libraries/LibUnicode/Locale.cpp @@ -766,6 +766,8 @@ StringView style_to_string(Style style) } } +Span __attribute__((weak)) get_available_calendars() { return {}; } +Span __attribute__((weak)) get_available_number_systems() { return {}; } Optional __attribute__((weak)) locale_from_string(StringView) { return {}; } Optional __attribute__((weak)) language_from_string(StringView) { return {}; } Optional __attribute__((weak)) territory_from_string(StringView) { return {}; } diff --git a/Userland/Libraries/LibUnicode/Locale.h b/Userland/Libraries/LibUnicode/Locale.h index 18f66ba17d..e25d7ddb54 100644 --- a/Userland/Libraries/LibUnicode/Locale.h +++ b/Userland/Libraries/LibUnicode/Locale.h @@ -145,6 +145,9 @@ Optional canonicalize_unicode_locale_id(LocaleID&); String const& default_locale(); bool is_locale_available(StringView locale); +Span get_available_calendars(); +Span get_available_number_systems(); + Style style_from_string(StringView style); StringView style_to_string(Style style); diff --git a/Userland/Libraries/LibUnicode/NumberFormat.cpp b/Userland/Libraries/LibUnicode/NumberFormat.cpp index e9cbc2a4b4..13b5199000 100644 --- a/Userland/Libraries/LibUnicode/NumberFormat.cpp +++ b/Userland/Libraries/LibUnicode/NumberFormat.cpp @@ -16,7 +16,6 @@ namespace Unicode { -Span __attribute__((weak)) get_available_number_systems() { return {}; } Optional __attribute__((weak)) number_system_from_string(StringView) { return {}; } Optional __attribute__((weak)) get_number_system_symbol(StringView, StringView, NumericSymbol) { return {}; } Optional __attribute__((weak)) get_number_system_groupings(StringView, StringView) { return {}; } diff --git a/Userland/Libraries/LibUnicode/NumberFormat.h b/Userland/Libraries/LibUnicode/NumberFormat.h index 1407516f68..96670cd78e 100644 --- a/Userland/Libraries/LibUnicode/NumberFormat.h +++ b/Userland/Libraries/LibUnicode/NumberFormat.h @@ -66,8 +66,6 @@ enum class NumericSymbol : u8 { PlusSign, }; -Span get_available_number_systems(); - Optional number_system_from_string(StringView system); Optional get_default_number_system(StringView locale);