mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-12-01 09:27:05 +01:00
fix(lang): sync_lang.py leaves the developer tab's rows to English, as the test does
The developer tab's rows (Ini.*) and the words of its lists (Choice.*) come in English where a language lacks them (SimulatorKeyRows), and LocalizationTests counts them optional. sync_lang.py added them to every language as untranslated copies; now it adds them, as the other optional keys, only with --all, and --check finds every language in line.
This commit is contained in:
+5
-4
@@ -5,8 +5,8 @@ For every language file in StarterNG/startercfg/lang (or the codes given):
|
||||
- a key en.xml has and the language lacks is added with the English text, right after the
|
||||
key it follows in en.xml, and marked <!-- untranslated -->;
|
||||
- a key en.xml no longer has is removed.
|
||||
Keys the starter falls back to English for by itself (ending in "Desc", starting with "Cmd.")
|
||||
are only added with --all. Everything else in the file - comments, order, line endings - stays
|
||||
Keys the starter falls back to English for by itself (ending in "Desc", starting with "Cmd.", and the
|
||||
developer tab's "Ini." rows and "Choice." words, see SimulatorKeyRows) are only added with --all. Everything else in the file - comments, order, line endings - stays
|
||||
as it is.
|
||||
|
||||
python tools/sync_lang.py # every language
|
||||
@@ -26,7 +26,8 @@ UNTRANSLATED = "<!-- untranslated -->"
|
||||
|
||||
|
||||
def is_optional(key):
|
||||
return key.endswith("Desc") or key.startswith("Cmd.")
|
||||
# As LocalizationTests.Every_language_has_every_key_but_the_optional_ones has them.
|
||||
return key.endswith("Desc") or key.startswith(("Cmd.", "Ini.", "Choice."))
|
||||
|
||||
|
||||
def read(path):
|
||||
@@ -148,7 +149,7 @@ def sync(path, en_text, en_strings, add_optional, check):
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
||||
parser.add_argument("codes", nargs="*", help="language codes, e.g. zh cz; every language when none")
|
||||
parser.add_argument("--all", action="store_true", help="add the optional keys (*Desc, Cmd.*) too")
|
||||
parser.add_argument("--all", action="store_true", help="add the optional keys (*Desc, Cmd.*, Ini.*, Choice.*) too")
|
||||
parser.add_argument("--check", action="store_true", help="only report, change nothing")
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user