Add messageWarn translation definition type

This commit is contained in:
Alvin Wong
2021-03-31 18:29:53 +08:00
parent 53c02dca33
commit e01361ddde
32 changed files with 276 additions and 60 deletions

View File

@@ -127,6 +127,15 @@ def get_letter_counts(defs: dict, lang: dict) -> List[str]:
else:
text_list.append(obj[eid])
obj = lang["messagesWarn"]
for mod in defs["messagesWarn"]:
eid = mod["id"]
if isinstance(obj[eid], list):
text_list.append(obj[eid][0])
text_list.append(obj[eid][1])
else:
text_list.append(obj[eid])
obj = lang["characters"]
for mod in defs["characters"]:
@@ -403,6 +412,23 @@ def write_language(lang: dict, defs: dict, f: TextIO) -> None:
f.write("\n")
obj = lang["messagesWarn"]
for mod in defs["messagesWarn"]:
eid = mod["id"]
if isinstance(obj[eid], list):
if not obj[eid][1]:
source_text = obj[eid][0]
else:
source_text = obj[eid][0] + "\n" + obj[eid][1]
else:
source_text = "\n" + obj[eid]
translated_text = convert_string(symbol_conversion_table, source_text)
source_text = source_text.replace("\n", "_")
f.write(f'const char* {eid} = "{translated_text}";//{source_text} \n')
f.write("\n")
# ----- Writing Characters
obj = lang["characters"]