1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 19:34:59 +00:00

LibUnicode: Ensure UnicodeNumberFormat is aware of default content

For example, there isn't a unique set of data for the en-US locale;
rather, it defaults to the data for the en locale. See this commit for
much more detail: 357c97dfa8
This commit is contained in:
Timothy Flynn 2021-11-12 19:10:07 -05:00 committed by Linus Groh
parent 9421d5c0cf
commit e9493a2cd5
4 changed files with 45 additions and 36 deletions

View file

@ -247,7 +247,7 @@ static void parse_number_systems(String locale_numbers_path, UnicodeLocaleData&
});
}
static void parse_all_locales(String numbers_path, UnicodeLocaleData& locale_data)
static void parse_all_locales(String core_path, String numbers_path, UnicodeLocaleData& locale_data)
{
auto numbers_iterator = path_to_dir_iterator(move(numbers_path));
@ -277,6 +277,8 @@ static void parse_all_locales(String numbers_path, UnicodeLocaleData& locale_dat
auto& locale = locale_data.locales.ensure(*language);
parse_number_systems(numbers_path, locale_data, locale);
}
parse_default_content_locales(move(core_path), locale_data);
}
static String format_identifier(StringView owner, String identifier)
@ -576,11 +578,13 @@ int main(int argc, char** argv)
{
char const* generated_header_path = nullptr;
char const* generated_implementation_path = nullptr;
char const* core_path = nullptr;
char const* numbers_path = nullptr;
Core::ArgsParser args_parser;
args_parser.add_option(generated_header_path, "Path to the Unicode locale header file to generate", "generated-header-path", 'h', "generated-header-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(core_path, "Path to cldr-core directory", "core-path", 'r', "core-path");
args_parser.add_option(numbers_path, "Path to cldr-numbers directory", "numbers-path", 'n', "numbers-path");
args_parser.parse(argc, argv);
@ -604,7 +608,7 @@ int main(int argc, char** argv)
auto generated_implementation_file = open_file(generated_implementation_path, "-c/--generated-implementation-path", Core::OpenMode::ReadWrite);
UnicodeLocaleData locale_data;
parse_all_locales(numbers_path, locale_data);
parse_all_locales(core_path, numbers_path, locale_data);
generate_unicode_locale_header(generated_header_file, locale_data);
generate_unicode_locale_implementation(generated_implementation_file, locale_data);