Locale script
This commit is contained in:
@@ -149,6 +149,7 @@ def processLanguageList():
|
||||
f.write(headerKeys)
|
||||
|
||||
# Generate language list.
|
||||
langValues = {}
|
||||
headerLocale = "#pragma once\n#include \"locale/localeinfo.h\"\n\n"
|
||||
headerLocale += "typedef enum {\n"
|
||||
count = 0
|
||||
@@ -156,6 +157,7 @@ def processLanguageList():
|
||||
count += 1
|
||||
for lang in LANGUAGE_DATA:
|
||||
langKey = lang.replace('-', '_').replace(' ', '_').upper()
|
||||
langValues[lang] = count
|
||||
headerLocale += f" DUSK_LOCALE_{langKey} = {count},\n"
|
||||
count += 1
|
||||
headerLocale += f" DUSK_LOCALE_COUNT = {count}\n"
|
||||
@@ -169,6 +171,13 @@ def processLanguageList():
|
||||
headerLocale += f" }},\n"
|
||||
headerLocale += "};\n"
|
||||
|
||||
headerLocale += f"static const char_t *LOCALE_SCRIPT = \n"
|
||||
for lang in LANGUAGE_DATA:
|
||||
langKey = lang.replace('-', '_').replace(' ', '_').upper()
|
||||
langValue = langValues[lang]
|
||||
headerLocale += f" \"DUSK_LOCALE_{langKey} = {langValue}\\n\"\n"
|
||||
headerLocale += ";\n"
|
||||
|
||||
# Write out the locale enum header file
|
||||
outputFile = os.path.join(args.headers_dir, "locale", "locale.h")
|
||||
os.makedirs(os.path.dirname(outputFile), exist_ok=True)
|
||||
|
||||
Reference in New Issue
Block a user