Compare commits

...

1 Commits

Author SHA1 Message Date
Martchus c12e505866 WIP: IANA language stuff 2021-01-20 21:50:04 +01:00
2 changed files with 48178 additions and 0 deletions

View File

@ -0,0 +1,37 @@
#!/usr/bin/cmake -DOUTPUT_PATH=iana_language_subtag_registry.cpp -P
# generates C++ code for the language-subtag-registry from www.iana.org, see https://tools.ietf.org/html/bcp47 and https://tools.ietf.org/html/rfc5646
cmake_minimum_required(VERSION 3.3.0 FATAL_ERROR)
if (NOT LANGUAGE_FILE)
set(LANGUAGE_FILE "language-subtag-registry.txt")
endif ()
if (EXISTS "${LANGUAGE_FILE}")
message(STATUS "Using existing language-subtag-registry file \"${LANGUAGE_FILE}\"")
else()
message(STATUS "Downloading language-subtag-registry file from www.iana.org")
file(DOWNLOAD "https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry" "${LANGUAGE_FILE}")
endif()
if (NOT OUTPUT_PATH)
message(FATAL_ERROR "No OUTPUT_PATH specified.")
endif()
file(STRINGS "${LANGUAGE_FILE}" LANGUAGE_LIST)
set(CURRENT_TYPE "")
foreach (LINE ${LANGUAGE_LIST})
if (NOT CURRENT_TYPE)
if (LINE MATCHES "Type: (.*)")
set(CURRENT_TYPE "${CMAKE_MATCH_1}")
endif ()
else ()
if (LINE STREQUAL "%%")
unset(CURRENT_TYPE)
continue()
endif ()
if (CURRENT_TYPE STREQUAL "language")
if (LINE MATCHES "Description: (.*)")
message(STATUS "${CMAKE_MATCH_1}")
endif ()
endif ()
endif ()
#message(STATUS "Processing line: ${LINE}")
endforeach()

File diff suppressed because it is too large Load Diff