|
@@ -33,38 +33,6 @@ static ByteString format_identifier(StringView owner, ByteString identifier)
|
|
return identifier;
|
|
return identifier;
|
|
}
|
|
}
|
|
|
|
|
|
-struct DisplayPattern {
|
|
|
|
- unsigned hash() const
|
|
|
|
- {
|
|
|
|
- return pair_int_hash(locale_pattern, locale_separator);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- bool operator==(DisplayPattern const& other) const
|
|
|
|
- {
|
|
|
|
- return (locale_pattern == other.locale_pattern)
|
|
|
|
- && (locale_separator == other.locale_separator);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- size_t locale_pattern { 0 };
|
|
|
|
- size_t locale_separator { 0 };
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-template<>
|
|
|
|
-struct AK::Formatter<DisplayPattern> : Formatter<FormatString> {
|
|
|
|
- ErrorOr<void> format(FormatBuilder& builder, DisplayPattern const& patterns)
|
|
|
|
- {
|
|
|
|
- return Formatter<FormatString>::format(builder,
|
|
|
|
- "{{ {}, {} }}"sv,
|
|
|
|
- patterns.locale_pattern,
|
|
|
|
- patterns.locale_separator);
|
|
|
|
- }
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-template<>
|
|
|
|
-struct AK::Traits<DisplayPattern> : public DefaultTraits<DisplayPattern> {
|
|
|
|
- static unsigned hash(DisplayPattern const& p) { return p.hash(); }
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
struct ListPatterns {
|
|
struct ListPatterns {
|
|
unsigned hash() const
|
|
unsigned hash() const
|
|
{
|
|
{
|
|
@@ -143,31 +111,10 @@ struct AK::Traits<TextLayout> : public DefaultTraits<TextLayout> {
|
|
static unsigned hash(TextLayout const& t) { return t.hash(); }
|
|
static unsigned hash(TextLayout const& t) { return t.hash(); }
|
|
};
|
|
};
|
|
|
|
|
|
-using LanguageList = Vector<size_t>;
|
|
|
|
-using TerritoryList = Vector<size_t>;
|
|
|
|
-using ScriptList = Vector<size_t>;
|
|
|
|
-using CurrencyList = Vector<size_t>;
|
|
|
|
-using CalendarList = Vector<size_t>;
|
|
|
|
-using DateFieldList = Vector<size_t>;
|
|
|
|
using KeywordList = Vector<size_t>;
|
|
using KeywordList = Vector<size_t>;
|
|
using ListPatternList = Vector<size_t>;
|
|
using ListPatternList = Vector<size_t>;
|
|
|
|
|
|
struct LocaleData {
|
|
struct LocaleData {
|
|
- ByteString language;
|
|
|
|
- Optional<ByteString> territory;
|
|
|
|
- Optional<ByteString> variant;
|
|
|
|
- size_t display_patterns { 0 };
|
|
|
|
- size_t languages { 0 };
|
|
|
|
- size_t territories { 0 };
|
|
|
|
- size_t scripts { 0 };
|
|
|
|
- size_t long_currencies { 0 };
|
|
|
|
- size_t short_currencies { 0 };
|
|
|
|
- size_t narrow_currencies { 0 };
|
|
|
|
- size_t numeric_currencies { 0 };
|
|
|
|
- size_t calendars { 0 };
|
|
|
|
- size_t long_date_fields { 0 };
|
|
|
|
- size_t short_date_fields { 0 };
|
|
|
|
- size_t narrow_date_fields { 0 };
|
|
|
|
size_t calendar_keywords { 0 };
|
|
size_t calendar_keywords { 0 };
|
|
size_t collation_case_keywords { 0 };
|
|
size_t collation_case_keywords { 0 };
|
|
size_t collation_numeric_keywords { 0 };
|
|
size_t collation_numeric_keywords { 0 };
|
|
@@ -183,13 +130,6 @@ struct LanguageMapping {
|
|
|
|
|
|
struct CLDR {
|
|
struct CLDR {
|
|
UniqueStringStorage unique_strings;
|
|
UniqueStringStorage unique_strings;
|
|
- UniqueStorage<DisplayPattern> unique_display_patterns;
|
|
|
|
- UniqueStorage<LanguageList> unique_language_lists;
|
|
|
|
- UniqueStorage<TerritoryList> unique_territory_lists;
|
|
|
|
- UniqueStorage<ScriptList> unique_script_lists;
|
|
|
|
- UniqueStorage<CurrencyList> unique_currency_lists;
|
|
|
|
- UniqueStorage<CalendarList> unique_calendar_lists;
|
|
|
|
- UniqueStorage<DateFieldList> unique_date_field_lists;
|
|
|
|
UniqueStorage<KeywordList> unique_keyword_lists;
|
|
UniqueStorage<KeywordList> unique_keyword_lists;
|
|
UniqueStorage<ListPatterns> unique_list_patterns;
|
|
UniqueStorage<ListPatterns> unique_list_patterns;
|
|
UniqueStorage<ListPatternList> unique_list_pattern_lists;
|
|
UniqueStorage<ListPatternList> unique_list_pattern_lists;
|
|
@@ -198,44 +138,12 @@ struct CLDR {
|
|
HashMap<ByteString, LocaleData> locales;
|
|
HashMap<ByteString, LocaleData> locales;
|
|
Vector<Alias> locale_aliases;
|
|
Vector<Alias> locale_aliases;
|
|
|
|
|
|
- Vector<ByteString> languages;
|
|
|
|
- HashMap<StringView, size_t> language_indices;
|
|
|
|
-
|
|
|
|
- Vector<ByteString> territories;
|
|
|
|
- HashMap<StringView, size_t> territory_indices;
|
|
|
|
-
|
|
|
|
- Vector<ByteString> scripts;
|
|
|
|
- HashMap<StringView, size_t> script_indices;
|
|
|
|
-
|
|
|
|
- Vector<ByteString> variants;
|
|
|
|
- HashMap<StringView, size_t> variant_indices;
|
|
|
|
-
|
|
|
|
- Vector<ByteString> currencies;
|
|
|
|
- HashMap<StringView, size_t> currency_indices;
|
|
|
|
-
|
|
|
|
- Vector<ByteString> date_fields;
|
|
|
|
- HashMap<StringView, size_t> date_fields_indices;
|
|
|
|
-
|
|
|
|
- Vector<Alias> date_field_aliases {
|
|
|
|
- // ECMA-402 and the CLDR refer to some date fields with different names. Defining these aliases
|
|
|
|
- // means we can remain agnostic about the naming differences elsewhere.
|
|
|
|
- { "dayperiod"sv, "dayPeriod"sv },
|
|
|
|
- { "week"sv, "weekOfYear"sv },
|
|
|
|
- { "zone"sv, "timeZoneName"sv },
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
HashMap<ByteString, Vector<ByteString>> keywords;
|
|
HashMap<ByteString, Vector<ByteString>> keywords;
|
|
HashMap<ByteString, Vector<Alias>> keyword_aliases;
|
|
HashMap<ByteString, Vector<Alias>> keyword_aliases;
|
|
HashMap<ByteString, ByteString> keyword_names;
|
|
HashMap<ByteString, ByteString> keyword_names;
|
|
|
|
|
|
Vector<ByteString> list_pattern_types;
|
|
Vector<ByteString> list_pattern_types;
|
|
Vector<ByteString> character_orders;
|
|
Vector<ByteString> character_orders;
|
|
- HashMap<ByteString, size_t> language_aliases;
|
|
|
|
- HashMap<ByteString, size_t> territory_aliases;
|
|
|
|
- HashMap<ByteString, size_t> script_aliases;
|
|
|
|
- HashMap<ByteString, size_t> variant_aliases;
|
|
|
|
- HashMap<ByteString, size_t> subdivision_aliases;
|
|
|
|
- Vector<LanguageMapping> complex_mappings;
|
|
|
|
Vector<LanguageMapping> likely_subtags;
|
|
Vector<LanguageMapping> likely_subtags;
|
|
size_t max_variant_size { 0 };
|
|
size_t max_variant_size { 0 };
|
|
};
|
|
};
|
|
@@ -273,40 +181,6 @@ static ErrorOr<LanguageMapping> parse_language_mapping(CLDR& cldr, StringView ke
|
|
return LanguageMapping { move(parsed_key), move(parsed_alias) };
|
|
return LanguageMapping { move(parsed_key), move(parsed_alias) };
|
|
}
|
|
}
|
|
|
|
|
|
-static ErrorOr<void> parse_core_aliases(ByteString core_supplemental_path, CLDR& cldr)
|
|
|
|
-{
|
|
|
|
- LexicalPath core_aliases_path(move(core_supplemental_path));
|
|
|
|
- core_aliases_path = core_aliases_path.append("aliases.json"sv);
|
|
|
|
-
|
|
|
|
- auto core_aliases = TRY(read_json_file(core_aliases_path.string()));
|
|
|
|
- auto const& supplemental_object = core_aliases.as_object().get_object("supplemental"sv).value();
|
|
|
|
- auto const& metadata_object = supplemental_object.get_object("metadata"sv).value();
|
|
|
|
- auto const& alias_object = metadata_object.get_object("alias"sv).value();
|
|
|
|
-
|
|
|
|
- auto append_aliases = [&](auto& alias_object, auto& alias_map) {
|
|
|
|
- alias_object.for_each_member([&](auto const& key, JsonValue const& value) {
|
|
|
|
- auto alias = value.as_object().get_byte_string("_replacement"sv).value();
|
|
|
|
-
|
|
|
|
- if (key.contains('-')) {
|
|
|
|
- auto mapping = TRY_OR_DISCARD(parse_language_mapping(cldr, key, alias));
|
|
|
|
- cldr.max_variant_size = max(mapping.key.variants.size(), cldr.max_variant_size);
|
|
|
|
- cldr.max_variant_size = max(mapping.alias.variants.size(), cldr.max_variant_size);
|
|
|
|
- cldr.complex_mappings.append(move(mapping));
|
|
|
|
- } else {
|
|
|
|
- alias_map.set(key, cldr.unique_strings.ensure(alias));
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- append_aliases(alias_object.get_object("languageAlias"sv).value(), cldr.language_aliases);
|
|
|
|
- append_aliases(alias_object.get_object("territoryAlias"sv).value(), cldr.territory_aliases);
|
|
|
|
- append_aliases(alias_object.get_object("scriptAlias"sv).value(), cldr.script_aliases);
|
|
|
|
- append_aliases(alias_object.get_object("variantAlias"sv).value(), cldr.variant_aliases);
|
|
|
|
- append_aliases(alias_object.get_object("subdivisionAlias"sv).value(), cldr.subdivision_aliases);
|
|
|
|
-
|
|
|
|
- return {};
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static ErrorOr<void> parse_likely_subtags(ByteString core_supplemental_path, CLDR& cldr)
|
|
static ErrorOr<void> parse_likely_subtags(ByteString core_supplemental_path, CLDR& cldr)
|
|
{
|
|
{
|
|
LexicalPath likely_subtags_path(move(core_supplemental_path));
|
|
LexicalPath likely_subtags_path(move(core_supplemental_path));
|
|
@@ -326,149 +200,6 @@ static ErrorOr<void> parse_likely_subtags(ByteString core_supplemental_path, CLD
|
|
return {};
|
|
return {};
|
|
}
|
|
}
|
|
|
|
|
|
-static ErrorOr<void> parse_identity(ByteString locale_path, CLDR& cldr, LocaleData& locale)
|
|
|
|
-{
|
|
|
|
- LexicalPath locale_display_names_path(move(locale_path)); // Note: Every JSON file defines identity data, so we can use any of them.
|
|
|
|
- locale_display_names_path = locale_display_names_path.append("localeDisplayNames.json"sv);
|
|
|
|
-
|
|
|
|
- auto const& locale_display_names = *TRY(read_json_file_with_cache(locale_display_names_path.string()));
|
|
|
|
- auto const& main_object = locale_display_names.as_object().get_object("main"sv).value();
|
|
|
|
- auto const& locale_object = main_object.get_object(locale_display_names_path.parent().basename()).value();
|
|
|
|
- auto const& identity_object = locale_object.get_object("identity"sv).value();
|
|
|
|
- auto const& language_string = identity_object.get_byte_string("language"sv).value();
|
|
|
|
- auto const& territory_string = identity_object.get_byte_string("territory"sv);
|
|
|
|
- auto const& script_string = identity_object.get_byte_string("script"sv);
|
|
|
|
- auto const& variant_string = identity_object.get_byte_string("variant"sv);
|
|
|
|
-
|
|
|
|
- locale.language = language_string;
|
|
|
|
-
|
|
|
|
- if (territory_string.has_value()) {
|
|
|
|
- locale.territory = territory_string.value();
|
|
|
|
-
|
|
|
|
- if (!cldr.territory_indices.contains(*locale.territory)) {
|
|
|
|
- cldr.territory_indices.set(*locale.territory, 0);
|
|
|
|
- cldr.territories.append(*locale.territory);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (script_string.has_value()) {
|
|
|
|
- auto const& script = script_string.value();
|
|
|
|
-
|
|
|
|
- if (!cldr.script_indices.contains(script)) {
|
|
|
|
- cldr.script_indices.set(script, 0);
|
|
|
|
- cldr.scripts.append(script);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (variant_string.has_value()) {
|
|
|
|
- locale.variant = variant_string.value();
|
|
|
|
-
|
|
|
|
- if (!cldr.variant_indices.contains(*locale.variant)) {
|
|
|
|
- cldr.variant_indices.set(*locale.variant, 0);
|
|
|
|
- cldr.variants.append(*locale.variant);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return {};
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static ErrorOr<void> parse_locale_display_patterns(ByteString locale_path, CLDR& cldr, LocaleData& locale)
|
|
|
|
-{
|
|
|
|
- LexicalPath locale_display_names_path(move(locale_path));
|
|
|
|
- locale_display_names_path = locale_display_names_path.append("localeDisplayNames.json"sv);
|
|
|
|
-
|
|
|
|
- auto const& locale_display_names = *TRY(read_json_file_with_cache(locale_display_names_path.string()));
|
|
|
|
- auto const& main_object = locale_display_names.as_object().get_object("main"sv).value();
|
|
|
|
- auto const& locale_object = main_object.get_object(locale_display_names_path.parent().basename()).value();
|
|
|
|
- auto const& locale_display_names_object = locale_object.get_object("localeDisplayNames"sv).value();
|
|
|
|
- auto const& locale_display_patterns_object = locale_display_names_object.get_object("localeDisplayPattern"sv).value();
|
|
|
|
- auto const& locale_pattern = locale_display_patterns_object.get_byte_string("localePattern"sv).value();
|
|
|
|
- auto const& locale_separator = locale_display_patterns_object.get_byte_string("localeSeparator"sv).value();
|
|
|
|
-
|
|
|
|
- DisplayPattern patterns {};
|
|
|
|
- patterns.locale_pattern = cldr.unique_strings.ensure(locale_pattern);
|
|
|
|
- patterns.locale_separator = cldr.unique_strings.ensure(locale_separator);
|
|
|
|
-
|
|
|
|
- locale.display_patterns = cldr.unique_display_patterns.ensure(move(patterns));
|
|
|
|
- return {};
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static ErrorOr<void> preprocess_languages(ByteString locale_path, CLDR& cldr)
|
|
|
|
-{
|
|
|
|
- LexicalPath languages_path(move(locale_path));
|
|
|
|
- languages_path = languages_path.append("languages.json"sv);
|
|
|
|
-
|
|
|
|
- if (!FileSystem::exists(languages_path.string()))
|
|
|
|
- return {};
|
|
|
|
-
|
|
|
|
- auto const& locale_languages = *TRY(read_json_file_with_cache(languages_path.string()));
|
|
|
|
- auto const& main_object = locale_languages.as_object().get_object("main"sv).value();
|
|
|
|
- auto const& locale_object = main_object.get_object(languages_path.parent().basename()).value();
|
|
|
|
- auto const& locale_display_names_object = locale_object.get_object("localeDisplayNames"sv).value();
|
|
|
|
- auto const& languages_object = locale_display_names_object.get_object("languages"sv).value();
|
|
|
|
-
|
|
|
|
- languages_object.for_each_member([&](auto const& key, auto const&) {
|
|
|
|
- if (!key.contains("-alt-"sv) && !cldr.language_indices.contains(key)) {
|
|
|
|
- cldr.language_indices.set(key, 0);
|
|
|
|
- cldr.languages.append(key);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- return {};
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static ErrorOr<void> preprocess_currencies(ByteString numbers_path, CLDR& cldr)
|
|
|
|
-{
|
|
|
|
- LexicalPath currencies_path(move(numbers_path));
|
|
|
|
- currencies_path = currencies_path.append("currencies.json"sv);
|
|
|
|
-
|
|
|
|
- auto const& locale_currencies = *TRY(read_json_file_with_cache(currencies_path.string()));
|
|
|
|
- auto const& main_object = locale_currencies.as_object().get_object("main"sv).value();
|
|
|
|
- auto const& locale_object = main_object.get_object(currencies_path.parent().basename()).value();
|
|
|
|
- auto const& locale_numbers_object = locale_object.get_object("numbers"sv).value();
|
|
|
|
- auto const& currencies_object = locale_numbers_object.get_object("currencies"sv).value();
|
|
|
|
-
|
|
|
|
- currencies_object.for_each_member([&](auto const& key, JsonValue const&) {
|
|
|
|
- if (!cldr.currency_indices.contains(key)) {
|
|
|
|
- cldr.currency_indices.set(key, 0);
|
|
|
|
- cldr.currencies.append(key);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- return {};
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static bool is_sanctioned_date_field(StringView field)
|
|
|
|
-{
|
|
|
|
- // This is a copy of the units sanctioned for use within ECMA-402, with names adjusted for the names used by the CLDR.
|
|
|
|
- // https://tc39.es/ecma402/#table-validcodeforDateField
|
|
|
|
- return field.is_one_of("era"sv, "year"sv, "quarter"sv, "month"sv, "week"sv, "weekday"sv, "day"sv, "dayperiod"sv, "hour"sv, "minute"sv, "second"sv, "zone"sv);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static ErrorOr<void> preprocess_date_fields(ByteString dates_path, CLDR& cldr)
|
|
|
|
-{
|
|
|
|
- LexicalPath date_fields_path(move(dates_path));
|
|
|
|
- date_fields_path = date_fields_path.append("dateFields.json"sv);
|
|
|
|
-
|
|
|
|
- auto const& locale_date_fields = *TRY(read_json_file_with_cache(date_fields_path.string()));
|
|
|
|
- auto const& main_object = locale_date_fields.as_object().get_object("main"sv).value();
|
|
|
|
- auto const& locale_object = main_object.get_object(date_fields_path.parent().basename()).value();
|
|
|
|
- auto const& dates_object = locale_object.get_object("dates"sv).value();
|
|
|
|
- auto const& fields_object = dates_object.get_object("fields"sv).value();
|
|
|
|
-
|
|
|
|
- fields_object.for_each_member([&](auto const& key, JsonValue const&) {
|
|
|
|
- if (!is_sanctioned_date_field(key))
|
|
|
|
- return;
|
|
|
|
-
|
|
|
|
- if (!cldr.date_fields_indices.contains(key)) {
|
|
|
|
- cldr.date_fields_indices.set(key, 0);
|
|
|
|
- cldr.date_fields.append(key);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- return {};
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static ErrorOr<void> parse_unicode_extension_keywords(ByteString bcp47_path, CLDR& cldr)
|
|
static ErrorOr<void> parse_unicode_extension_keywords(ByteString bcp47_path, CLDR& cldr)
|
|
{
|
|
{
|
|
constexpr auto desired_keywords = Array { "ca"sv, "co"sv, "hc"sv, "kf"sv, "kn"sv, "nu"sv };
|
|
constexpr auto desired_keywords = Array { "ca"sv, "co"sv, "hc"sv, "kf"sv, "kn"sv, "nu"sv };
|
|
@@ -533,102 +264,6 @@ static Optional<ByteString> find_keyword_alias(StringView key, StringView calend
|
|
return alias->name;
|
|
return alias->name;
|
|
}
|
|
}
|
|
|
|
|
|
-static ErrorOr<void> parse_locale_languages(ByteString locale_path, CLDR& cldr, LocaleData& locale)
|
|
|
|
-{
|
|
|
|
- LexicalPath languages_path(move(locale_path));
|
|
|
|
- languages_path = languages_path.append("languages.json"sv);
|
|
|
|
-
|
|
|
|
- LanguageList languages;
|
|
|
|
- languages.resize(cldr.languages.size());
|
|
|
|
-
|
|
|
|
- if (!FileSystem::exists(languages_path.string())) {
|
|
|
|
- for (size_t i = 0; i < languages.size(); ++i)
|
|
|
|
- languages[i] = cldr.unique_strings.ensure(cldr.languages[i]);
|
|
|
|
-
|
|
|
|
- locale.languages = cldr.unique_language_lists.ensure(move(languages));
|
|
|
|
- return {};
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- auto const& locale_languages = *TRY(read_json_file_with_cache(languages_path.string()));
|
|
|
|
- auto const& main_object = locale_languages.as_object().get_object("main"sv).value();
|
|
|
|
- auto const& locale_object = main_object.get_object(languages_path.parent().basename()).value();
|
|
|
|
- auto const& locale_display_names_object = locale_object.get_object("localeDisplayNames"sv).value();
|
|
|
|
- auto const& languages_object = locale_display_names_object.get_object("languages"sv).value();
|
|
|
|
-
|
|
|
|
- languages_object.for_each_member([&](auto const& key, JsonValue const& value) {
|
|
|
|
- if (key.contains("-alt-"sv))
|
|
|
|
- return;
|
|
|
|
-
|
|
|
|
- auto index = cldr.language_indices.get(key).value();
|
|
|
|
- languages[index] = cldr.unique_strings.ensure(value.as_string());
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- locale.languages = cldr.unique_language_lists.ensure(move(languages));
|
|
|
|
- return {};
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static ErrorOr<void> parse_locale_territories(ByteString locale_path, CLDR& cldr, LocaleData& locale)
|
|
|
|
-{
|
|
|
|
- LexicalPath territories_path(move(locale_path));
|
|
|
|
- territories_path = territories_path.append("territories.json"sv);
|
|
|
|
-
|
|
|
|
- TerritoryList territories;
|
|
|
|
- territories.resize(cldr.territories.size());
|
|
|
|
-
|
|
|
|
- if (!FileSystem::exists(territories_path.string())) {
|
|
|
|
- for (size_t i = 0; i < territories.size(); ++i)
|
|
|
|
- territories[i] = cldr.unique_strings.ensure(cldr.territories[i]);
|
|
|
|
-
|
|
|
|
- locale.territories = cldr.unique_territory_lists.ensure(move(territories));
|
|
|
|
- return {};
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- auto locale_territories = TRY(read_json_file(territories_path.string()));
|
|
|
|
- auto const& main_object = locale_territories.as_object().get_object("main"sv).value();
|
|
|
|
- auto const& locale_object = main_object.get_object(territories_path.parent().basename()).value();
|
|
|
|
- auto const& locale_display_names_object = locale_object.get_object("localeDisplayNames"sv).value();
|
|
|
|
- auto const& territories_object = locale_display_names_object.get_object("territories"sv).value();
|
|
|
|
-
|
|
|
|
- territories_object.for_each_member([&](auto const& key, JsonValue const& value) {
|
|
|
|
- if (auto index = cldr.territory_indices.get(key); index.has_value())
|
|
|
|
- territories[*index] = cldr.unique_strings.ensure(value.as_string());
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- locale.territories = cldr.unique_territory_lists.ensure(move(territories));
|
|
|
|
- return {};
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static ErrorOr<void> parse_locale_scripts(ByteString locale_path, CLDR& cldr, LocaleData& locale)
|
|
|
|
-{
|
|
|
|
- LexicalPath scripts_path(move(locale_path));
|
|
|
|
- scripts_path = scripts_path.append("scripts.json"sv);
|
|
|
|
-
|
|
|
|
- ScriptList scripts;
|
|
|
|
- scripts.resize(cldr.scripts.size());
|
|
|
|
-
|
|
|
|
- if (!FileSystem::exists(scripts_path.string())) {
|
|
|
|
- for (size_t i = 0; i < scripts.size(); ++i)
|
|
|
|
- scripts[i] = cldr.unique_strings.ensure(cldr.scripts[i]);
|
|
|
|
-
|
|
|
|
- locale.scripts = cldr.unique_script_lists.ensure(move(scripts));
|
|
|
|
- return {};
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- auto locale_scripts = TRY(read_json_file(scripts_path.string()));
|
|
|
|
- auto const& main_object = locale_scripts.as_object().get_object("main"sv).value();
|
|
|
|
- auto const& locale_object = main_object.get_object(scripts_path.parent().basename()).value();
|
|
|
|
- auto const& locale_display_names_object = locale_object.get_object("localeDisplayNames"sv).value();
|
|
|
|
- auto const& scripts_object = locale_display_names_object.get_object("scripts"sv).value();
|
|
|
|
-
|
|
|
|
- scripts_object.for_each_member([&](auto const& key, JsonValue const& value) {
|
|
|
|
- if (auto index = cldr.script_indices.get(key); index.has_value())
|
|
|
|
- scripts[*index] = cldr.unique_strings.ensure(value.as_string());
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- locale.scripts = cldr.unique_script_lists.ensure(move(scripts));
|
|
|
|
- return {};
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static ErrorOr<void> parse_locale_list_patterns(ByteString misc_path, CLDR& cldr, LocaleData& locale)
|
|
static ErrorOr<void> parse_locale_list_patterns(ByteString misc_path, CLDR& cldr, LocaleData& locale)
|
|
{
|
|
{
|
|
LexicalPath list_patterns_path(move(misc_path));
|
|
LexicalPath list_patterns_path(move(misc_path));
|
|
@@ -711,124 +346,6 @@ static ErrorOr<void> parse_locale_layout(ByteString misc_path, CLDR& cldr, Local
|
|
return {};
|
|
return {};
|
|
}
|
|
}
|
|
|
|
|
|
-static ErrorOr<void> parse_locale_currencies(ByteString numbers_path, CLDR& cldr, LocaleData& locale)
|
|
|
|
-{
|
|
|
|
- LexicalPath currencies_path(move(numbers_path));
|
|
|
|
- currencies_path = currencies_path.append("currencies.json"sv);
|
|
|
|
-
|
|
|
|
- auto const& locale_currencies = *TRY(read_json_file_with_cache(currencies_path.string()));
|
|
|
|
- auto const& main_object = locale_currencies.as_object().get_object("main"sv).value();
|
|
|
|
- auto const& locale_object = main_object.get_object(currencies_path.parent().basename()).value();
|
|
|
|
- auto const& locale_numbers_object = locale_object.get_object("numbers"sv).value();
|
|
|
|
- auto const& currencies_object = locale_numbers_object.get_object("currencies"sv).value();
|
|
|
|
-
|
|
|
|
- CurrencyList long_currencies {};
|
|
|
|
- long_currencies.resize(cldr.currencies.size());
|
|
|
|
-
|
|
|
|
- CurrencyList short_currencies {};
|
|
|
|
- short_currencies.resize(cldr.currencies.size());
|
|
|
|
-
|
|
|
|
- CurrencyList narrow_currencies {};
|
|
|
|
- narrow_currencies.resize(cldr.currencies.size());
|
|
|
|
-
|
|
|
|
- CurrencyList numeric_currencies {};
|
|
|
|
- numeric_currencies.resize(cldr.currencies.size());
|
|
|
|
-
|
|
|
|
- currencies_object.for_each_member([&](auto const& key, JsonValue const& value) {
|
|
|
|
- auto long_name = value.as_object().get_byte_string("displayName"sv).value_or(key);
|
|
|
|
- auto short_name = value.as_object().get_byte_string("symbol"sv).value_or(key);
|
|
|
|
- auto narrow_name = value.as_object().get_byte_string("symbol-alt-narrow"sv);
|
|
|
|
- auto numeric_name = value.as_object().get_byte_string("displayName-count-other"sv);
|
|
|
|
-
|
|
|
|
- auto index = cldr.currency_indices.get(key).value();
|
|
|
|
- long_currencies[index] = cldr.unique_strings.ensure(move(long_name));
|
|
|
|
- short_currencies[index] = cldr.unique_strings.ensure(move(short_name));
|
|
|
|
- narrow_currencies[index] = narrow_name.has_value() ? cldr.unique_strings.ensure(narrow_name.release_value()) : 0;
|
|
|
|
- numeric_currencies[index] = numeric_name.has_value() ? cldr.unique_strings.ensure(numeric_name.release_value()) : long_currencies[index];
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- locale.long_currencies = cldr.unique_currency_lists.ensure(move(long_currencies));
|
|
|
|
- locale.short_currencies = cldr.unique_currency_lists.ensure(move(short_currencies));
|
|
|
|
- locale.narrow_currencies = cldr.unique_currency_lists.ensure(move(narrow_currencies));
|
|
|
|
- locale.numeric_currencies = cldr.unique_currency_lists.ensure(move(numeric_currencies));
|
|
|
|
- return {};
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static ErrorOr<void> parse_locale_calendars(ByteString locale_path, CLDR& cldr, LocaleData& locale)
|
|
|
|
-{
|
|
|
|
- LexicalPath locale_display_names_path(move(locale_path));
|
|
|
|
- locale_display_names_path = locale_display_names_path.append("localeDisplayNames.json"sv);
|
|
|
|
-
|
|
|
|
- auto const& locale_display_names = *TRY(read_json_file_with_cache(locale_display_names_path.string()));
|
|
|
|
- auto const& main_object = locale_display_names.as_object().get_object("main"sv).value();
|
|
|
|
- auto const& locale_object = main_object.get_object(locale_display_names_path.parent().basename()).value();
|
|
|
|
- auto const& locale_display_names_object = locale_object.get_object("localeDisplayNames"sv).value();
|
|
|
|
-
|
|
|
|
- if (!locale_display_names_object.has_object("types"sv))
|
|
|
|
- return {};
|
|
|
|
-
|
|
|
|
- auto const& types_object = locale_display_names_object.get_object("types"sv).value();
|
|
|
|
- auto const& calendar_object = types_object.get_object("calendar"sv).value();
|
|
|
|
-
|
|
|
|
- auto const& supported_calendars = cldr.keywords.find("ca"sv)->value;
|
|
|
|
-
|
|
|
|
- CalendarList calendars;
|
|
|
|
- calendars.resize(supported_calendars.size());
|
|
|
|
-
|
|
|
|
- calendar_object.for_each_member([&](auto const& key, auto const& calendar) {
|
|
|
|
- auto index = supported_calendars.find_first_index(key);
|
|
|
|
- if (!index.has_value()) {
|
|
|
|
- auto alias = find_keyword_alias("ca"sv, key, cldr);
|
|
|
|
- index = supported_calendars.find_first_index(*alias);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- calendars[*index] = cldr.unique_strings.ensure(calendar.as_string());
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- locale.calendars = cldr.unique_calendar_lists.ensure(move(calendars));
|
|
|
|
- return {};
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static ErrorOr<void> parse_locale_date_fields(ByteString dates_path, CLDR& cldr, LocaleData& locale)
|
|
|
|
-{
|
|
|
|
- LexicalPath date_fields_path(move(dates_path));
|
|
|
|
- date_fields_path = date_fields_path.append("dateFields.json"sv);
|
|
|
|
-
|
|
|
|
- auto const& locale_date_fields = *TRY(read_json_file_with_cache(date_fields_path.string()));
|
|
|
|
- auto const& main_object = locale_date_fields.as_object().get_object("main"sv).value();
|
|
|
|
- auto const& locale_object = main_object.get_object(date_fields_path.parent().basename()).value();
|
|
|
|
- auto const& dates_object = locale_object.get_object("dates"sv).value();
|
|
|
|
- auto const& fields_object = dates_object.get_object("fields"sv).value();
|
|
|
|
-
|
|
|
|
- DateFieldList long_date_fields {};
|
|
|
|
- long_date_fields.resize(cldr.date_fields.size());
|
|
|
|
-
|
|
|
|
- DateFieldList short_date_fields {};
|
|
|
|
- short_date_fields.resize(cldr.date_fields.size());
|
|
|
|
-
|
|
|
|
- DateFieldList narrow_date_fields {};
|
|
|
|
- narrow_date_fields.resize(cldr.date_fields.size());
|
|
|
|
-
|
|
|
|
- fields_object.for_each_member([&](auto const& key, JsonValue const& value) {
|
|
|
|
- if (!is_sanctioned_date_field(key))
|
|
|
|
- return;
|
|
|
|
-
|
|
|
|
- auto const& long_name = value.as_object().get_byte_string("displayName"sv).value();
|
|
|
|
- auto const& short_name = fields_object.get_object(ByteString::formatted("{}-short", key))->get_byte_string("displayName"sv).value();
|
|
|
|
- auto const& narrow_name = fields_object.get_object(ByteString::formatted("{}-narrow", key))->get_byte_string("displayName"sv).value();
|
|
|
|
-
|
|
|
|
- auto index = cldr.date_fields_indices.get(key).value();
|
|
|
|
- long_date_fields[index] = cldr.unique_strings.ensure(long_name);
|
|
|
|
- short_date_fields[index] = cldr.unique_strings.ensure(short_name);
|
|
|
|
- narrow_date_fields[index] = cldr.unique_strings.ensure(narrow_name);
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- locale.long_date_fields = cldr.unique_date_field_lists.ensure(move(long_date_fields));
|
|
|
|
- locale.short_date_fields = cldr.unique_date_field_lists.ensure(move(short_date_fields));
|
|
|
|
- locale.narrow_date_fields = cldr.unique_date_field_lists.ensure(move(narrow_date_fields));
|
|
|
|
- return {};
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static ErrorOr<void> parse_number_system_keywords(ByteString locale_numbers_path, CLDR& cldr, LocaleData& locale)
|
|
static ErrorOr<void> parse_number_system_keywords(ByteString locale_numbers_path, CLDR& cldr, LocaleData& locale)
|
|
{
|
|
{
|
|
LexicalPath numbers_path(move(locale_numbers_path));
|
|
LexicalPath numbers_path(move(locale_numbers_path));
|
|
@@ -1008,13 +525,12 @@ static ErrorOr<void> define_aliases_without_scripts(CLDR& cldr)
|
|
return {};
|
|
return {};
|
|
}
|
|
}
|
|
|
|
|
|
-static ErrorOr<void> parse_all_locales(ByteString bcp47_path, ByteString core_path, ByteString locale_names_path, ByteString misc_path, ByteString numbers_path, ByteString dates_path, CLDR& cldr)
|
|
|
|
|
|
+static ErrorOr<void> parse_all_locales(ByteString bcp47_path, ByteString core_path, ByteString misc_path, ByteString numbers_path, ByteString dates_path, CLDR& cldr)
|
|
{
|
|
{
|
|
LexicalPath core_supplemental_path(core_path);
|
|
LexicalPath core_supplemental_path(core_path);
|
|
core_supplemental_path = core_supplemental_path.append("supplemental"sv);
|
|
core_supplemental_path = core_supplemental_path.append("supplemental"sv);
|
|
VERIFY(FileSystem::is_directory(core_supplemental_path.string()));
|
|
VERIFY(FileSystem::is_directory(core_supplemental_path.string()));
|
|
|
|
|
|
- TRY(parse_core_aliases(core_supplemental_path.string(), cldr));
|
|
|
|
TRY(parse_likely_subtags(core_supplemental_path.string(), cldr));
|
|
TRY(parse_likely_subtags(core_supplemental_path.string(), cldr));
|
|
|
|
|
|
auto remove_variants_from_path = [&](ByteString path) -> ErrorOr<ByteString> {
|
|
auto remove_variants_from_path = [&](ByteString path) -> ErrorOr<ByteString> {
|
|
@@ -1030,66 +546,12 @@ static ErrorOr<void> parse_all_locales(ByteString bcp47_path, ByteString core_pa
|
|
return builder.to_byte_string();
|
|
return builder.to_byte_string();
|
|
};
|
|
};
|
|
|
|
|
|
- TRY(Core::Directory::for_each_entry(TRY(String::formatted("{}/main", locale_names_path)), Core::DirIterator::SkipParentAndBaseDir, [&](auto& entry, auto& directory) -> ErrorOr<IterationDecision> {
|
|
|
|
- auto locale_path = LexicalPath::join(directory.path().string(), entry.name).string();
|
|
|
|
- auto language = TRY(remove_variants_from_path(locale_path));
|
|
|
|
-
|
|
|
|
- auto& locale = cldr.locales.ensure(language);
|
|
|
|
- TRY(parse_identity(locale_path, cldr, locale));
|
|
|
|
- return IterationDecision::Continue;
|
|
|
|
- }));
|
|
|
|
-
|
|
|
|
- TRY(Core::Directory::for_each_entry(TRY(String::formatted("{}/main", locale_names_path)), Core::DirIterator::SkipParentAndBaseDir, [&](auto& entry, auto& directory) -> ErrorOr<IterationDecision> {
|
|
|
|
- auto locale_path = LexicalPath::join(directory.path().string(), entry.name).string();
|
|
|
|
- TRY(preprocess_languages(locale_path, cldr));
|
|
|
|
- return IterationDecision::Continue;
|
|
|
|
- }));
|
|
|
|
-
|
|
|
|
- TRY(Core::Directory::for_each_entry(TRY(String::formatted("{}/main", numbers_path)), Core::DirIterator::SkipParentAndBaseDir, [&](auto& entry, auto& directory) -> ErrorOr<IterationDecision> {
|
|
|
|
- auto numbers_path = LexicalPath::join(directory.path().string(), entry.name).string();
|
|
|
|
- TRY(preprocess_currencies(numbers_path, cldr));
|
|
|
|
- return IterationDecision::Continue;
|
|
|
|
- }));
|
|
|
|
-
|
|
|
|
- TRY(Core::Directory::for_each_entry(TRY(String::formatted("{}/main", dates_path)), Core::DirIterator::SkipParentAndBaseDir, [&](auto& entry, auto& directory) -> ErrorOr<IterationDecision> {
|
|
|
|
- auto dates_path = LexicalPath::join(directory.path().string(), entry.name).string();
|
|
|
|
- TRY(preprocess_date_fields(dates_path, cldr));
|
|
|
|
- return IterationDecision::Continue;
|
|
|
|
- }));
|
|
|
|
-
|
|
|
|
- auto update_indices = [](auto& keys, auto& indices) {
|
|
|
|
- quick_sort(keys);
|
|
|
|
-
|
|
|
|
- for (size_t i = 0; i < keys.size(); ++i)
|
|
|
|
- indices.set(keys[i], i);
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- update_indices(cldr.languages, cldr.language_indices);
|
|
|
|
- update_indices(cldr.territories, cldr.territory_indices);
|
|
|
|
- update_indices(cldr.scripts, cldr.script_indices);
|
|
|
|
- update_indices(cldr.variants, cldr.variant_indices);
|
|
|
|
- update_indices(cldr.currencies, cldr.currency_indices);
|
|
|
|
- update_indices(cldr.date_fields, cldr.date_fields_indices);
|
|
|
|
-
|
|
|
|
TRY(Core::Directory::for_each_entry(TRY(String::formatted("{}/bcp47", bcp47_path)), Core::DirIterator::SkipParentAndBaseDir, [&](auto& entry, auto& directory) -> ErrorOr<IterationDecision> {
|
|
TRY(Core::Directory::for_each_entry(TRY(String::formatted("{}/bcp47", bcp47_path)), Core::DirIterator::SkipParentAndBaseDir, [&](auto& entry, auto& directory) -> ErrorOr<IterationDecision> {
|
|
auto bcp47_path = LexicalPath::join(directory.path().string(), entry.name).string();
|
|
auto bcp47_path = LexicalPath::join(directory.path().string(), entry.name).string();
|
|
TRY(parse_unicode_extension_keywords(move(bcp47_path), cldr));
|
|
TRY(parse_unicode_extension_keywords(move(bcp47_path), cldr));
|
|
return IterationDecision::Continue;
|
|
return IterationDecision::Continue;
|
|
}));
|
|
}));
|
|
|
|
|
|
- TRY(Core::Directory::for_each_entry(TRY(String::formatted("{}/main", locale_names_path)), Core::DirIterator::SkipParentAndBaseDir, [&](auto& entry, auto& directory) -> ErrorOr<IterationDecision> {
|
|
|
|
- auto locale_path = LexicalPath::join(directory.path().string(), entry.name).string();
|
|
|
|
- auto language = TRY(remove_variants_from_path(locale_path));
|
|
|
|
-
|
|
|
|
- auto& locale = cldr.locales.ensure(language);
|
|
|
|
- TRY(parse_locale_display_patterns(locale_path, cldr, locale));
|
|
|
|
- TRY(parse_locale_languages(locale_path, cldr, locale));
|
|
|
|
- TRY(parse_locale_territories(locale_path, cldr, locale));
|
|
|
|
- TRY(parse_locale_scripts(locale_path, cldr, locale));
|
|
|
|
- TRY(parse_locale_calendars(locale_path, cldr, locale));
|
|
|
|
- return IterationDecision::Continue;
|
|
|
|
- }));
|
|
|
|
-
|
|
|
|
TRY(Core::Directory::for_each_entry(TRY(String::formatted("{}/main", misc_path)), Core::DirIterator::SkipParentAndBaseDir, [&](auto& entry, auto& directory) -> ErrorOr<IterationDecision> {
|
|
TRY(Core::Directory::for_each_entry(TRY(String::formatted("{}/main", misc_path)), Core::DirIterator::SkipParentAndBaseDir, [&](auto& entry, auto& directory) -> ErrorOr<IterationDecision> {
|
|
auto misc_path = LexicalPath::join(directory.path().string(), entry.name).string();
|
|
auto misc_path = LexicalPath::join(directory.path().string(), entry.name).string();
|
|
auto language = TRY(remove_variants_from_path(misc_path));
|
|
auto language = TRY(remove_variants_from_path(misc_path));
|
|
@@ -1105,7 +567,6 @@ static ErrorOr<void> parse_all_locales(ByteString bcp47_path, ByteString core_pa
|
|
auto language = TRY(remove_variants_from_path(numbers_path));
|
|
auto language = TRY(remove_variants_from_path(numbers_path));
|
|
|
|
|
|
auto& locale = cldr.locales.ensure(language);
|
|
auto& locale = cldr.locales.ensure(language);
|
|
- TRY(parse_locale_currencies(numbers_path, cldr, locale));
|
|
|
|
TRY(parse_number_system_keywords(numbers_path, cldr, locale));
|
|
TRY(parse_number_system_keywords(numbers_path, cldr, locale));
|
|
fill_in_collation_keywords(cldr, locale);
|
|
fill_in_collation_keywords(cldr, locale);
|
|
return IterationDecision::Continue;
|
|
return IterationDecision::Continue;
|
|
@@ -1116,7 +577,6 @@ static ErrorOr<void> parse_all_locales(ByteString bcp47_path, ByteString core_pa
|
|
auto language = TRY(remove_variants_from_path(dates_path));
|
|
auto language = TRY(remove_variants_from_path(dates_path));
|
|
|
|
|
|
auto& locale = cldr.locales.ensure(language);
|
|
auto& locale = cldr.locales.ensure(language);
|
|
- TRY(parse_locale_date_fields(dates_path, cldr, locale));
|
|
|
|
TRY(parse_calendar_keywords(dates_path, cldr, locale));
|
|
TRY(parse_calendar_keywords(dates_path, cldr, locale));
|
|
return IterationDecision::Continue;
|
|
return IterationDecision::Continue;
|
|
}));
|
|
}));
|
|
@@ -1144,12 +604,6 @@ namespace Locale {
|
|
auto keywords = cldr.keywords.keys();
|
|
auto keywords = cldr.keywords.keys();
|
|
|
|
|
|
generate_enum(generator, format_identifier, "Locale"sv, "None"sv, locales, cldr.locale_aliases);
|
|
generate_enum(generator, format_identifier, "Locale"sv, "None"sv, locales, cldr.locale_aliases);
|
|
- generate_enum(generator, format_identifier, "Language"sv, {}, cldr.languages);
|
|
|
|
- generate_enum(generator, format_identifier, "Territory"sv, {}, cldr.territories);
|
|
|
|
- generate_enum(generator, format_identifier, "ScriptTag"sv, {}, cldr.scripts);
|
|
|
|
- generate_enum(generator, format_identifier, "Currency"sv, {}, cldr.currencies);
|
|
|
|
- generate_enum(generator, format_identifier, "DateField"sv, {}, cldr.date_fields, cldr.date_field_aliases);
|
|
|
|
- generate_enum(generator, format_identifier, "Variant"sv, {}, cldr.variants);
|
|
|
|
generate_enum(generator, format_identifier, "ListPatternType"sv, {}, cldr.list_pattern_types);
|
|
generate_enum(generator, format_identifier, "ListPatternType"sv, {}, cldr.list_pattern_types);
|
|
generate_enum(generator, format_identifier, "CharacterOrder"sv, {}, cldr.character_orders);
|
|
generate_enum(generator, format_identifier, "CharacterOrder"sv, {}, cldr.character_orders);
|
|
generate_enum(generator, format_identifier, "Key"sv, {}, keywords);
|
|
generate_enum(generator, format_identifier, "Key"sv, {}, keywords);
|
|
@@ -1180,7 +634,6 @@ static ErrorOr<void> generate_unicode_locale_implementation(Core::InputBufferedF
|
|
SourceGenerator generator { builder };
|
|
SourceGenerator generator { builder };
|
|
generator.set("string_index_type"sv, string_index_type);
|
|
generator.set("string_index_type"sv, string_index_type);
|
|
generator.set("locales_size"sv, ByteString::number(cldr.locales.size()));
|
|
generator.set("locales_size"sv, ByteString::number(cldr.locales.size()));
|
|
- generator.set("territories_size", ByteString::number(cldr.territories.size()));
|
|
|
|
generator.set("variants_size", ByteString::number(cldr.max_variant_size));
|
|
generator.set("variants_size", ByteString::number(cldr.max_variant_size));
|
|
|
|
|
|
generator.append(R"~~~(
|
|
generator.append(R"~~~(
|
|
@@ -1202,20 +655,6 @@ namespace Locale {
|
|
cldr.unique_strings.generate(generator);
|
|
cldr.unique_strings.generate(generator);
|
|
|
|
|
|
generator.append(R"~~~(
|
|
generator.append(R"~~~(
|
|
-struct DisplayPatternImpl {
|
|
|
|
- DisplayPattern to_display_pattern() const
|
|
|
|
- {
|
|
|
|
- DisplayPattern display_patterns {};
|
|
|
|
- display_patterns.locale_pattern = decode_string(locale_pattern);
|
|
|
|
- display_patterns.locale_separator = decode_string(locale_separator);
|
|
|
|
-
|
|
|
|
- return display_patterns;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @string_index_type@ locale_pattern { 0 };
|
|
|
|
- @string_index_type@ locale_separator { 0 };
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
struct Patterns {
|
|
struct Patterns {
|
|
ListPatternType type;
|
|
ListPatternType type;
|
|
Style style;
|
|
Style style;
|
|
@@ -1244,7 +683,6 @@ struct TextLayout {
|
|
});
|
|
});
|
|
generate_available_values(generator, "get_available_hour_cycles"sv, cldr.keywords.find("hc"sv)->value);
|
|
generate_available_values(generator, "get_available_hour_cycles"sv, cldr.keywords.find("hc"sv)->value);
|
|
generate_available_values(generator, "get_available_number_systems"sv, cldr.keywords.find("nu"sv)->value);
|
|
generate_available_values(generator, "get_available_number_systems"sv, cldr.keywords.find("nu"sv)->value);
|
|
- generate_available_values(generator, "get_available_currencies"sv, cldr.currencies);
|
|
|
|
|
|
|
|
generator.append(R"~~~(
|
|
generator.append(R"~~~(
|
|
ReadonlySpan<StringView> get_available_keyword_values(StringView key)
|
|
ReadonlySpan<StringView> get_available_keyword_values(StringView key)
|
|
@@ -1272,13 +710,6 @@ ReadonlySpan<StringView> get_available_keyword_values(StringView key)
|
|
}
|
|
}
|
|
)~~~");
|
|
)~~~");
|
|
|
|
|
|
- cldr.unique_display_patterns.generate(generator, "DisplayPatternImpl"sv, "s_display_patterns"sv, 30);
|
|
|
|
- cldr.unique_language_lists.generate(generator, string_index_type, "s_language_lists"sv);
|
|
|
|
- cldr.unique_territory_lists.generate(generator, string_index_type, "s_territory_lists"sv);
|
|
|
|
- cldr.unique_script_lists.generate(generator, string_index_type, "s_script_lists"sv);
|
|
|
|
- cldr.unique_currency_lists.generate(generator, string_index_type, "s_currency_lists"sv);
|
|
|
|
- cldr.unique_calendar_lists.generate(generator, string_index_type, "s_calendar_lists"sv);
|
|
|
|
- cldr.unique_date_field_lists.generate(generator, string_index_type, "s_date_field_lists"sv);
|
|
|
|
cldr.unique_keyword_lists.generate(generator, string_index_type, "s_keyword_lists"sv);
|
|
cldr.unique_keyword_lists.generate(generator, string_index_type, "s_keyword_lists"sv);
|
|
cldr.unique_list_patterns.generate(generator, "Patterns"sv, "s_list_patterns"sv, 10);
|
|
cldr.unique_list_patterns.generate(generator, "Patterns"sv, "s_list_patterns"sv, 10);
|
|
cldr.unique_list_pattern_lists.generate(generator, cldr.unique_list_patterns.type_that_fits(), "s_list_pattern_lists"sv);
|
|
cldr.unique_list_pattern_lists.generate(generator, cldr.unique_list_patterns.type_that_fits(), "s_list_pattern_lists"sv);
|
|
@@ -1328,18 +759,6 @@ static constexpr Array<@type@, @size@> @name@ { {)~~~");
|
|
auto locales = cldr.locales.keys();
|
|
auto locales = cldr.locales.keys();
|
|
quick_sort(locales);
|
|
quick_sort(locales);
|
|
|
|
|
|
- append_mapping(locales, cldr.locales, cldr.unique_display_patterns.type_that_fits(), "s_locale_display_patterns"sv, [&](auto const& locale) { return locale.display_patterns; });
|
|
|
|
- append_mapping(locales, cldr.locales, cldr.unique_language_lists.type_that_fits(), "s_languages"sv, [&](auto const& locale) { return locale.languages; });
|
|
|
|
- append_mapping(locales, cldr.locales, cldr.unique_territory_lists.type_that_fits(), "s_territories"sv, [&](auto const& locale) { return locale.territories; });
|
|
|
|
- append_mapping(locales, cldr.locales, cldr.unique_script_lists.type_that_fits(), "s_scripts"sv, [&](auto const& locale) { return locale.scripts; });
|
|
|
|
- append_mapping(locales, cldr.locales, cldr.unique_currency_lists.type_that_fits(), "s_long_currencies"sv, [&](auto const& locale) { return locale.long_currencies; });
|
|
|
|
- append_mapping(locales, cldr.locales, cldr.unique_currency_lists.type_that_fits(), "s_short_currencies"sv, [&](auto const& locale) { return locale.short_currencies; });
|
|
|
|
- append_mapping(locales, cldr.locales, cldr.unique_currency_lists.type_that_fits(), "s_narrow_currencies"sv, [&](auto const& locale) { return locale.narrow_currencies; });
|
|
|
|
- append_mapping(locales, cldr.locales, cldr.unique_currency_lists.type_that_fits(), "s_numeric_currencies"sv, [&](auto const& locale) { return locale.numeric_currencies; });
|
|
|
|
- append_mapping(locales, cldr.locales, cldr.unique_calendar_lists.type_that_fits(), "s_calendars"sv, [&](auto const& locale) { return locale.calendars; });
|
|
|
|
- append_mapping(locales, cldr.locales, cldr.unique_date_field_lists.type_that_fits(), "s_long_date_fields"sv, [&](auto const& locale) { return locale.long_date_fields; });
|
|
|
|
- append_mapping(locales, cldr.locales, cldr.unique_date_field_lists.type_that_fits(), "s_short_date_fields"sv, [&](auto const& locale) { return locale.short_date_fields; });
|
|
|
|
- append_mapping(locales, cldr.locales, cldr.unique_date_field_lists.type_that_fits(), "s_narrow_date_fields"sv, [&](auto const& locale) { return locale.narrow_date_fields; });
|
|
|
|
append_mapping(locales, cldr.locales, cldr.unique_keyword_lists.type_that_fits(), "s_calendar_keywords"sv, [&](auto const& locale) { return locale.calendar_keywords; });
|
|
append_mapping(locales, cldr.locales, cldr.unique_keyword_lists.type_that_fits(), "s_calendar_keywords"sv, [&](auto const& locale) { return locale.calendar_keywords; });
|
|
append_mapping(locales, cldr.locales, cldr.unique_keyword_lists.type_that_fits(), "s_collation_case_keywords"sv, [&](auto const& locale) { return locale.collation_case_keywords; });
|
|
append_mapping(locales, cldr.locales, cldr.unique_keyword_lists.type_that_fits(), "s_collation_case_keywords"sv, [&](auto const& locale) { return locale.collation_case_keywords; });
|
|
append_mapping(locales, cldr.locales, cldr.unique_keyword_lists.type_that_fits(), "s_collation_numeric_keywords"sv, [&](auto const& locale) { return locale.collation_numeric_keywords; });
|
|
append_mapping(locales, cldr.locales, cldr.unique_keyword_lists.type_that_fits(), "s_collation_numeric_keywords"sv, [&](auto const& locale) { return locale.collation_numeric_keywords; });
|
|
@@ -1351,42 +770,11 @@ static constexpr Array<@type@, @size@> @name@ { {)~~~");
|
|
|
|
|
|
struct CanonicalLanguageID
|
|
struct CanonicalLanguageID
|
|
{
|
|
{
|
|
- LanguageID to_unicode_language_id() const
|
|
|
|
- {
|
|
|
|
- LanguageID language_id {};
|
|
|
|
- language_id.variants.ensure_capacity(variants_size);
|
|
|
|
-
|
|
|
|
- language_id.language = MUST(String::from_utf8(decode_string(language)));
|
|
|
|
- if (script != 0)
|
|
|
|
- language_id.script = MUST(String::from_utf8(decode_string(script)));
|
|
|
|
- if (region != 0)
|
|
|
|
- language_id.region = MUST(String::from_utf8(decode_string(region)));
|
|
|
|
- for (size_t i = 0; i < variants_size; ++i)
|
|
|
|
- language_id.variants.append(MUST(String::from_utf8(decode_string(variants[i]))));
|
|
|
|
-
|
|
|
|
- return language_id;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- bool matches_variants(Vector<String> const& other_variants) const {
|
|
|
|
- if (variants_size == 0)
|
|
|
|
- return true;
|
|
|
|
- if (other_variants.size() != variants_size)
|
|
|
|
- return false;
|
|
|
|
-
|
|
|
|
- for (size_t i = 0; i < variants_size; ++i) {
|
|
|
|
- if (decode_string(variants[i]) != other_variants[i])
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return true;
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
@string_index_type@ language { 0 };
|
|
@string_index_type@ language { 0 };
|
|
@string_index_type@ script { 0 };
|
|
@string_index_type@ script { 0 };
|
|
@string_index_type@ region { 0 };
|
|
@string_index_type@ region { 0 };
|
|
Array<@string_index_type@, @variants_size@> variants {};
|
|
Array<@string_index_type@, @variants_size@> variants {};
|
|
size_t variants_size { 0 };
|
|
size_t variants_size { 0 };
|
|
-
|
|
|
|
};
|
|
};
|
|
|
|
|
|
struct LanguageMapping {
|
|
struct LanguageMapping {
|
|
@@ -1436,7 +824,6 @@ static constexpr Array<LanguageMapping, @size@> s_@name@ { {
|
|
generator.append("} };\n");
|
|
generator.append("} };\n");
|
|
};
|
|
};
|
|
|
|
|
|
- append_complex_mapping("complex_alias"sv, cldr.complex_mappings);
|
|
|
|
append_complex_mapping("likely_subtags"sv, cldr.likely_subtags);
|
|
append_complex_mapping("likely_subtags"sv, cldr.likely_subtags);
|
|
|
|
|
|
generator.append(R"~~~(
|
|
generator.append(R"~~~(
|
|
@@ -1529,39 +916,6 @@ static LanguageMapping const* resolve_likely_subtag(LanguageID const& language_i
|
|
|
|
|
|
)~~~");
|
|
)~~~");
|
|
|
|
|
|
- auto append_mapping_search = [&](StringView enum_snake, StringView from_string_name, StringView collection_name, StringView unique_list) {
|
|
|
|
- generator.set("enum_snake", enum_snake);
|
|
|
|
- generator.set("from_string_name", from_string_name);
|
|
|
|
- generator.set("collection_name", collection_name);
|
|
|
|
- generator.set("unique_list", unique_list);
|
|
|
|
-
|
|
|
|
- generator.append(R"~~~(
|
|
|
|
-Optional<StringView> get_locale_@enum_snake@_mapping(StringView locale, StringView @enum_snake@)
|
|
|
|
-{
|
|
|
|
- auto locale_value = locale_from_string(locale);
|
|
|
|
- if (!locale_value.has_value())
|
|
|
|
- return {};
|
|
|
|
-
|
|
|
|
- auto @enum_snake@_value = @from_string_name@_from_string(@enum_snake@);
|
|
|
|
- if (!@enum_snake@_value.has_value())
|
|
|
|
- return {};
|
|
|
|
-
|
|
|
|
- auto locale_index = to_underlying(*locale_value) - 1; // Subtract 1 because 0 == Locale::None.
|
|
|
|
- auto @enum_snake@_index = to_underlying(*@enum_snake@_value);
|
|
|
|
-
|
|
|
|
- auto mapping_index = @collection_name@.at(locale_index);
|
|
|
|
- auto const& mappings = @unique_list@.at(mapping_index);
|
|
|
|
-
|
|
|
|
- auto @enum_snake@_string_index = mappings.at(@enum_snake@_index);
|
|
|
|
- auto @enum_snake@_mapping = decode_string(@enum_snake@_string_index);
|
|
|
|
-
|
|
|
|
- if (@enum_snake@_mapping.is_empty())
|
|
|
|
- return {};
|
|
|
|
- return @enum_snake@_mapping;
|
|
|
|
-}
|
|
|
|
-)~~~");
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
auto append_from_string = [&](StringView enum_title, StringView enum_snake, auto const& values, Vector<Alias> const& aliases = {}) -> ErrorOr<void> {
|
|
auto append_from_string = [&](StringView enum_title, StringView enum_snake, auto const& values, Vector<Alias> const& aliases = {}) -> ErrorOr<void> {
|
|
HashValueMap<ByteString> hashes;
|
|
HashValueMap<ByteString> hashes;
|
|
TRY(hashes.try_ensure_capacity(values.size()));
|
|
TRY(hashes.try_ensure_capacity(values.size()));
|
|
@@ -1576,47 +930,7 @@ Optional<StringView> get_locale_@enum_snake@_mapping(StringView locale, StringVi
|
|
return {};
|
|
return {};
|
|
};
|
|
};
|
|
|
|
|
|
- auto append_alias_search = [&](StringView enum_snake, auto const& aliases) -> ErrorOr<void> {
|
|
|
|
- HashValueMap<size_t> hashes;
|
|
|
|
- TRY(hashes.try_ensure_capacity(aliases.size()));
|
|
|
|
-
|
|
|
|
- for (auto const& alias : aliases)
|
|
|
|
- hashes.set(alias.key.hash(), alias.value);
|
|
|
|
-
|
|
|
|
- ValueFromStringOptions options {};
|
|
|
|
- options.return_type = "StringView"sv;
|
|
|
|
- options.return_format = "decode_string({})"sv;
|
|
|
|
-
|
|
|
|
- generate_value_from_string(generator, "resolve_{}_alias"sv, string_index_type, enum_snake, move(hashes), options);
|
|
|
|
-
|
|
|
|
- return {};
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
TRY(append_from_string("Locale"sv, "locale"sv, cldr.locales.keys(), cldr.locale_aliases));
|
|
TRY(append_from_string("Locale"sv, "locale"sv, cldr.locales.keys(), cldr.locale_aliases));
|
|
-
|
|
|
|
- TRY(append_from_string("Language"sv, "language"sv, cldr.languages));
|
|
|
|
- append_mapping_search("language"sv, "language"sv, "s_languages"sv, "s_language_lists"sv);
|
|
|
|
- TRY(append_alias_search("language"sv, cldr.language_aliases));
|
|
|
|
-
|
|
|
|
- TRY(append_from_string("Territory"sv, "territory"sv, cldr.territories));
|
|
|
|
- append_mapping_search("territory"sv, "territory"sv, "s_territories"sv, "s_territory_lists"sv);
|
|
|
|
- TRY(append_alias_search("territory"sv, cldr.territory_aliases));
|
|
|
|
-
|
|
|
|
- TRY(append_from_string("ScriptTag"sv, "script_tag"sv, cldr.scripts));
|
|
|
|
- append_mapping_search("script"sv, "script_tag"sv, "s_scripts"sv, "s_script_lists"sv);
|
|
|
|
- TRY(append_alias_search("script_tag"sv, cldr.script_aliases));
|
|
|
|
-
|
|
|
|
- TRY(append_from_string("Currency"sv, "currency"sv, cldr.currencies));
|
|
|
|
- append_mapping_search("long_currency"sv, "currency"sv, "s_long_currencies"sv, "s_currency_lists"sv);
|
|
|
|
- append_mapping_search("short_currency"sv, "currency"sv, "s_short_currencies"sv, "s_currency_lists"sv);
|
|
|
|
- append_mapping_search("narrow_currency"sv, "currency"sv, "s_narrow_currencies"sv, "s_currency_lists"sv);
|
|
|
|
- append_mapping_search("numeric_currency"sv, "currency"sv, "s_numeric_currencies"sv, "s_currency_lists"sv);
|
|
|
|
-
|
|
|
|
- TRY(append_from_string("DateField"sv, "date_field"sv, cldr.date_fields, cldr.date_field_aliases));
|
|
|
|
- append_mapping_search("long_date_field"sv, "date_field"sv, "s_long_date_fields"sv, "s_date_field_lists"sv);
|
|
|
|
- append_mapping_search("short_date_field"sv, "date_field"sv, "s_short_date_fields"sv, "s_date_field_lists"sv);
|
|
|
|
- append_mapping_search("narrow_date_field"sv, "date_field"sv, "s_narrow_date_fields"sv, "s_date_field_lists"sv);
|
|
|
|
-
|
|
|
|
TRY(append_from_string("Key"sv, "key"sv, cldr.keywords.keys()));
|
|
TRY(append_from_string("Key"sv, "key"sv, cldr.keywords.keys()));
|
|
|
|
|
|
for (auto const& keyword : cldr.keywords) {
|
|
for (auto const& keyword : cldr.keywords) {
|
|
@@ -1630,11 +944,6 @@ Optional<StringView> get_locale_@enum_snake@_mapping(StringView locale, StringVi
|
|
TRY(append_from_string(enum_name, enum_snake, keyword.value));
|
|
TRY(append_from_string(enum_name, enum_snake, keyword.value));
|
|
}
|
|
}
|
|
|
|
|
|
- append_mapping_search("calendar"sv, "keyword_ca"sv, "s_calendars"sv, "s_calendar_lists"sv);
|
|
|
|
-
|
|
|
|
- TRY(append_alias_search("variant"sv, cldr.variant_aliases));
|
|
|
|
- TRY(append_alias_search("subdivision"sv, cldr.subdivision_aliases));
|
|
|
|
-
|
|
|
|
TRY(append_from_string("ListPatternType"sv, "list_pattern_type"sv, cldr.list_pattern_types));
|
|
TRY(append_from_string("ListPatternType"sv, "list_pattern_type"sv, cldr.list_pattern_types));
|
|
|
|
|
|
TRY(append_from_string("CharacterOrder"sv, "character_order"sv, cldr.character_orders));
|
|
TRY(append_from_string("CharacterOrder"sv, "character_order"sv, cldr.character_orders));
|
|
@@ -1735,19 +1044,6 @@ Vector<StringView> get_keywords_for_locale(StringView locale, StringView key)
|
|
return keywords;
|
|
return keywords;
|
|
}
|
|
}
|
|
|
|
|
|
-Optional<DisplayPattern> get_locale_display_patterns(StringView locale)
|
|
|
|
-{
|
|
|
|
- auto locale_value = locale_from_string(locale);
|
|
|
|
- if (!locale_value.has_value())
|
|
|
|
- return {};
|
|
|
|
-
|
|
|
|
- auto locale_index = to_underlying(*locale_value) - 1; // Subtract 1 because 0 == Locale::None.
|
|
|
|
- auto display_patterns_index = s_locale_display_patterns.at(locale_index);
|
|
|
|
-
|
|
|
|
- auto const& display_patterns = s_display_patterns.at(display_patterns_index);
|
|
|
|
- return display_patterns.to_display_pattern();
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
Optional<ListPatterns> get_locale_list_patterns(StringView locale, StringView list_pattern_type, Style list_pattern_style)
|
|
Optional<ListPatterns> get_locale_list_patterns(StringView locale, StringView list_pattern_type, Style list_pattern_style)
|
|
{
|
|
{
|
|
auto locale_value = locale_from_string(locale);
|
|
auto locale_value = locale_from_string(locale);
|
|
@@ -1798,37 +1094,6 @@ Optional<CharacterOrder> character_order_for_locale(StringView locale)
|
|
return {};
|
|
return {};
|
|
}
|
|
}
|
|
|
|
|
|
-void resolve_complex_language_aliases(LanguageID& language_id)
|
|
|
|
-{
|
|
|
|
- for (auto const& map : s_complex_alias) {
|
|
|
|
- auto key_language = decode_string(map.key.language);
|
|
|
|
- auto key_script = decode_string(map.key.script);
|
|
|
|
- auto key_region = decode_string(map.key.region);
|
|
|
|
-
|
|
|
|
- if ((key_language != language_id.language) && (key_language != "und"sv))
|
|
|
|
- continue;
|
|
|
|
- if (!key_script.is_empty() && (key_script != language_id.script))
|
|
|
|
- continue;
|
|
|
|
- if (!key_region.is_empty() && (key_region != language_id.region))
|
|
|
|
- continue;
|
|
|
|
- if (!map.key.matches_variants(language_id.variants))
|
|
|
|
- continue;
|
|
|
|
-
|
|
|
|
- auto alias = map.alias.to_unicode_language_id();
|
|
|
|
-
|
|
|
|
- if (alias.language == "und"sv)
|
|
|
|
- alias.language = move(language_id.language);
|
|
|
|
- if (key_script.is_empty() && !alias.script.has_value())
|
|
|
|
- alias.script = move(language_id.script);
|
|
|
|
- if (key_region.is_empty() && !alias.region.has_value())
|
|
|
|
- alias.region = move(language_id.region);
|
|
|
|
- if (map.key.variants_size == 0 && alias.variants.is_empty())
|
|
|
|
- alias.variants = move(language_id.variants);
|
|
|
|
-
|
|
|
|
- language_id = move(alias);
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
|
|
Optional<LanguageID> add_likely_subtags(LanguageID const& language_id)
|
|
Optional<LanguageID> add_likely_subtags(LanguageID const& language_id)
|
|
{
|
|
{
|
|
@@ -1856,13 +1121,6 @@ Optional<LanguageID> add_likely_subtags(LanguageID const& language_id)
|
|
return maximized;
|
|
return maximized;
|
|
}
|
|
}
|
|
|
|
|
|
-Optional<String> resolve_most_likely_territory(LanguageID const& language_id)
|
|
|
|
-{
|
|
|
|
- if (auto const* likely_subtag = resolve_likely_subtag(language_id); likely_subtag != nullptr)
|
|
|
|
- return MUST(String::from_utf8(decode_string(likely_subtag->alias.region)));
|
|
|
|
- return OptionalNone {};
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
)~~~");
|
|
)~~~");
|
|
|
|
|
|
@@ -1876,7 +1134,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|
StringView generated_implementation_path;
|
|
StringView generated_implementation_path;
|
|
StringView bcp47_path;
|
|
StringView bcp47_path;
|
|
StringView core_path;
|
|
StringView core_path;
|
|
- StringView locale_names_path;
|
|
|
|
StringView misc_path;
|
|
StringView misc_path;
|
|
StringView numbers_path;
|
|
StringView numbers_path;
|
|
StringView dates_path;
|
|
StringView dates_path;
|
|
@@ -1886,7 +1143,6 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|
args_parser.add_option(generated_implementation_path, "Path to the Unicode locale implementation file to generate", "generated-implementation-path", 'c', "generated-implementation-path");
|
|
args_parser.add_option(generated_implementation_path, "Path to the Unicode locale implementation file to generate", "generated-implementation-path", 'c', "generated-implementation-path");
|
|
args_parser.add_option(bcp47_path, "Path to cldr-bcp47 directory", "bcp47-path", 'b', "bcp47-path");
|
|
args_parser.add_option(bcp47_path, "Path to cldr-bcp47 directory", "bcp47-path", 'b', "bcp47-path");
|
|
args_parser.add_option(core_path, "Path to cldr-core directory", "core-path", 'r', "core-path");
|
|
args_parser.add_option(core_path, "Path to cldr-core directory", "core-path", 'r', "core-path");
|
|
- args_parser.add_option(locale_names_path, "Path to cldr-localenames directory", "locale-names-path", 'l', "locale-names-path");
|
|
|
|
args_parser.add_option(misc_path, "Path to cldr-misc directory", "misc-path", 'm', "misc-path");
|
|
args_parser.add_option(misc_path, "Path to cldr-misc directory", "misc-path", 'm', "misc-path");
|
|
args_parser.add_option(numbers_path, "Path to cldr-numbers directory", "numbers-path", 'n', "numbers-path");
|
|
args_parser.add_option(numbers_path, "Path to cldr-numbers directory", "numbers-path", 'n', "numbers-path");
|
|
args_parser.add_option(dates_path, "Path to cldr-dates directory", "dates-path", 'd', "dates-path");
|
|
args_parser.add_option(dates_path, "Path to cldr-dates directory", "dates-path", 'd', "dates-path");
|
|
@@ -1896,7 +1152,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|
auto generated_implementation_file = TRY(open_file(generated_implementation_path, Core::File::OpenMode::Write));
|
|
auto generated_implementation_file = TRY(open_file(generated_implementation_path, Core::File::OpenMode::Write));
|
|
|
|
|
|
CLDR cldr;
|
|
CLDR cldr;
|
|
- TRY(parse_all_locales(bcp47_path, core_path, locale_names_path, misc_path, numbers_path, dates_path, cldr));
|
|
|
|
|
|
+ TRY(parse_all_locales(bcp47_path, core_path, misc_path, numbers_path, dates_path, cldr));
|
|
|
|
|
|
TRY(generate_unicode_locale_header(*generated_header_file, cldr));
|
|
TRY(generate_unicode_locale_header(*generated_header_file, cldr));
|
|
TRY(generate_unicode_locale_implementation(*generated_implementation_file, cldr));
|
|
TRY(generate_unicode_locale_implementation(*generated_implementation_file, cldr));
|