mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:38:11 +00:00
LibUnicode: Extract cldr-numbers dataset from CLDR database
This dataset holds the values needed to handle DisplayNames.prototype.of with a type option of "currency".
This commit is contained in:
parent
a029e3d38a
commit
297db925fc
2 changed files with 15 additions and 3 deletions
|
@ -437,11 +437,13 @@ int main(int argc, char** argv)
|
||||||
char const* generated_header_path = nullptr;
|
char const* generated_header_path = nullptr;
|
||||||
char const* generated_implementation_path = nullptr;
|
char const* generated_implementation_path = nullptr;
|
||||||
char const* locale_names_path = nullptr;
|
char const* locale_names_path = nullptr;
|
||||||
|
char const* numbers_path = nullptr;
|
||||||
|
|
||||||
Core::ArgsParser args_parser;
|
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_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(generated_implementation_path, "Path to the Unicode locale implementation file to generate", "generated-implementation-path", 'c', "generated-implementation-path");
|
||||||
args_parser.add_option(locale_names_path, "Path to cldr-localenames directory", "locale-names-path", 'l', "locale-names-path");
|
args_parser.add_option(locale_names_path, "Path to cldr-localenames directory", "locale-names-path", 'l', "locale-names-path");
|
||||||
|
args_parser.add_option(numbers_path, "Path to cldr-numbers directory", "numbers-path", 'n', "numbers-path");
|
||||||
args_parser.parse(argc, argv);
|
args_parser.parse(argc, argv);
|
||||||
|
|
||||||
auto open_file = [&](StringView path, StringView flags, Core::OpenMode mode = Core::OpenMode::ReadOnly) {
|
auto open_file = [&](StringView path, StringView flags, Core::OpenMode mode = Core::OpenMode::ReadOnly) {
|
||||||
|
|
|
@ -43,6 +43,9 @@ set(CLDR_ZIP_PATH ${CLDR_PATH}/cldr.zip)
|
||||||
set(CLDR_LOCALES_SOURCE cldr-localenames-modern)
|
set(CLDR_LOCALES_SOURCE cldr-localenames-modern)
|
||||||
set(CLDR_LOCALES_PATH ${CLDR_PATH}/${CLDR_LOCALES_SOURCE})
|
set(CLDR_LOCALES_PATH ${CLDR_PATH}/${CLDR_LOCALES_SOURCE})
|
||||||
|
|
||||||
|
set(CLDR_NUMBERS_SOURCE cldr-numbers-modern)
|
||||||
|
set(CLDR_NUMBERS_PATH ${CLDR_PATH}/${CLDR_NUMBERS_SOURCE})
|
||||||
|
|
||||||
if (ENABLE_UNICODE_DATABASE_DOWNLOAD)
|
if (ENABLE_UNICODE_DATABASE_DOWNLOAD)
|
||||||
if (NOT EXISTS ${UNICODE_DATA_PATH})
|
if (NOT EXISTS ${UNICODE_DATA_PATH})
|
||||||
message(STATUS "Downloading UCD UnicodeData.txt from ${UNICODE_DATA_URL}...")
|
message(STATUS "Downloading UCD UnicodeData.txt from ${UNICODE_DATA_URL}...")
|
||||||
|
@ -101,7 +104,14 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD)
|
||||||
message(STATUS "Extracting CLDR ${CLDR_LOCALES_SOURCE} from ${CLDR_ZIP_PATH}...")
|
message(STATUS "Extracting CLDR ${CLDR_LOCALES_SOURCE} from ${CLDR_ZIP_PATH}...")
|
||||||
execute_process(COMMAND unzip -q ${CLDR_ZIP_PATH} "${CLDR_LOCALES_SOURCE}/*" -d ${CLDR_PATH} RESULT_VARIABLE unzip_result)
|
execute_process(COMMAND unzip -q ${CLDR_ZIP_PATH} "${CLDR_LOCALES_SOURCE}/*" -d ${CLDR_PATH} RESULT_VARIABLE unzip_result)
|
||||||
if (NOT unzip_result EQUAL 0)
|
if (NOT unzip_result EQUAL 0)
|
||||||
message(FATAL_ERROR "Failed to unzip ${CLDR_ZIP_PATH} with status ${unzip_result}")
|
message(FATAL_ERROR "Failed to unzip ${CLDR_LOCALES_SOURCE} from ${CLDR_ZIP_PATH} with status ${unzip_result}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
if(EXISTS ${CLDR_ZIP_PATH} AND NOT EXISTS ${CLDR_NUMBERS_PATH})
|
||||||
|
message(STATUS "Extracting CLDR ${CLDR_NUMBERS_SOURCE} from ${CLDR_ZIP_PATH}...")
|
||||||
|
execute_process(COMMAND unzip -q ${CLDR_ZIP_PATH} "${CLDR_NUMBERS_SOURCE}/*" -d ${CLDR_PATH} RESULT_VARIABLE unzip_result)
|
||||||
|
if (NOT unzip_result EQUAL 0)
|
||||||
|
message(FATAL_ERROR "Failed to unzip ${CLDR_NUMBERS_SOURCE} from ${CLDR_ZIP_PATH} with status ${unzip_result}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -128,9 +138,9 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD)
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${UNICODE_LOCALE_HEADER} ${UNICODE_LOCALE_IMPLEMENTATION}
|
OUTPUT ${UNICODE_LOCALE_HEADER} ${UNICODE_LOCALE_IMPLEMENTATION}
|
||||||
COMMAND $<TARGET_FILE:GenerateUnicodeLocale> -h ${UNICODE_LOCALE_HEADER} -c ${UNICODE_LOCALE_IMPLEMENTATION} -l ${CLDR_LOCALES_PATH}
|
COMMAND $<TARGET_FILE:GenerateUnicodeLocale> -h ${UNICODE_LOCALE_HEADER} -c ${UNICODE_LOCALE_IMPLEMENTATION} -l ${CLDR_LOCALES_PATH} -n ${CLDR_NUMBERS_PATH}
|
||||||
VERBATIM
|
VERBATIM
|
||||||
DEPENDS GenerateUnicodeLocale ${CLDR_LOCALES_PATH}
|
DEPENDS GenerateUnicodeLocale ${CLDR_LOCALES_PATH} ${CLDR_NUMBERS_PATH}
|
||||||
)
|
)
|
||||||
|
|
||||||
set(UNICODE_DATA_SOURCES ${UNICODE_DATA_HEADER} ${UNICODE_DATA_IMPLEMENTATION} ${UNICODE_LOCALE_HEADER} ${UNICODE_LOCALE_IMPLEMENTATION})
|
set(UNICODE_DATA_SOURCES ${UNICODE_DATA_HEADER} ${UNICODE_DATA_IMPLEMENTATION} ${UNICODE_LOCALE_HEADER} ${UNICODE_LOCALE_IMPLEMENTATION})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue