Fixed CI by enforcing en_us file read order

This commit is contained in:
Wofsauge committed 2024-09-29 16:46:41 +02:00
1 parent 20edb52286
commit a69758592d
1 file changed
+7 -5
+7 -5
View File
@@ -84,12 +84,12 @@ def compare_tables(table1, table2, prev_key):
return errorCount return errorCount
lua.execute('REPENTOGON = true; EID = {}; EID.descriptions = {} function EID:updateDescriptionsViaTable(changeTable, tableToUpdate) for k,v in pairs(changeTable) do if v == "" then tableToUpdate[k] = nil else tableToUpdate[k] = v end end end') lua.execute('REPENTOGON = true; EID = {}; EID.descriptions = {}; function EID:updateDescriptionsViaTable(changeTable, tableToUpdate) for k,v in pairs(changeTable) do if v == "" then tableToUpdate[k] = nil else tableToUpdate[k] = v end end end')
g = lua.globals() g = lua.globals()
# Read English language files first
print("reading: en_us.lua") for englishFile in glob.glob(SOURCE_MOD_DIRECTORY+"/**/ab+/en_us.lua", recursive=True) + glob.glob(SOURCE_MOD_DIRECTORY+"/**/rep/en_us.lua", recursive=True):
for englishFile in glob.glob(SOURCE_MOD_DIRECTORY+"/**/en_us.lua", recursive=True): print("reading:", englishFile)
lua.execute(open(englishFile, "r", encoding="UTF-8").read()) lua.execute(open(englishFile, "r", encoding="UTF-8").read())
en_us_entries = count_entries(g.EID['descriptions']['en_us']) en_us_entries = count_entries(g.EID['descriptions']['en_us'])
@@ -97,12 +97,14 @@ print("en_us entries:", en_us_entries)
languages = {} languages = {}
# Read other language files
for file in glob.glob(SOURCE_MOD_DIRECTORY+"/**/ab+/*.lua", recursive=True) + glob.glob(SOURCE_MOD_DIRECTORY+"/**/rep/*.lua", recursive=True): for file in glob.glob(SOURCE_MOD_DIRECTORY+"/**/ab+/*.lua", recursive=True) + glob.glob(SOURCE_MOD_DIRECTORY+"/**/rep/*.lua", recursive=True):
if "en_us" not in file and "transformations" not in file: if "en_us" not in file and "transformations" not in file:
print("reading:",file) print("reading:",file)
lua.execute(open(file, "r", encoding="UTF-8").read()) lua.execute(open(file, "r", encoding="UTF-8").read())
languages[os.path.basename(file).replace(".lua","")] = 0 languages[os.path.basename(file).replace(".lua","")] = 0
# Evaluate all languages
for lang in languages: for lang in languages:
print(f"Evaluating language '{lang}'..") print(f"Evaluating language '{lang}'..")
errorCount = compare_tables(g.EID['descriptions']['en_us'], g.EID['descriptions'][lang], lang) errorCount = compare_tables(g.EID['descriptions']['en_us'], g.EID['descriptions'][lang], lang)
@@ -111,7 +113,7 @@ for lang in languages:
print(f"{Red}Errors found: {errorCount} / {en_us_entries}{Color_Off}\n\n") print(f"{Red}Errors found: {errorCount} / {en_us_entries}{Color_Off}\n\n")
# Write git Workflow summary
gitWorkflowSummary = "### Translation progress\n| Language | Completion | Missing entries |\n|---|---|---|\n" gitWorkflowSummary = "### Translation progress\n| Language | Completion | Missing entries |\n|---|---|---|\n"
print(f"{Blue}Translation progress:{Color_Off}") print(f"{Blue}Translation progress:{Color_Off}")
for lang in languages: for lang in languages: