diff --git a/tools/translator/converter.py b/tools/translator/converter.py index d3c918e84e30..6cdf5e0a81ab 100644 --- a/tools/translator/converter.py +++ b/tools/translator/converter.py @@ -1,7 +1,9 @@ import git import json +import re BUILD_PATH = "./" +allowPathsRegexp = re.compile('^code/.*') repo = git.Repo(BUILD_PATH) tree = repo.head.commit.tree @@ -36,6 +38,16 @@ translation["files"][-1]["replaces"][-1]["replace"] += f"\n{line[1:]}" lastaction = "+" +filteredTranslation = {"files": []} +for file in translation['files']: + if not allowPathsRegexp.match(file['path']): + continue + filteredTranslation["files"].append(file) + +fullTranslation = json.load(open('ss220replace.json', encoding='utf-8')) +for file in filteredTranslation['files']: + fullTranslation["files"].append(file) + with open('ss220replace.json', 'w+', encoding='utf-8') as f: - json.dump(translation, f, ensure_ascii=False, indent=2) -print(f"Added translation for {len(translation['files'])} files.") + json.dump(fullTranslation, f, ensure_ascii=False, indent=2) +print(f"Added translation for {len(filteredTranslation['files'])} files.") diff --git a/tools/translator/ss220replace.json b/tools/translator/ss220replace.json index 804ffa9ffa91..29870a591d07 100644 --- a/tools/translator/ss220replace.json +++ b/tools/translator/ss220replace.json @@ -84,15 +84,6 @@ "replace": "\tadd_inherent_law(\"Вы не можете вмешиваться в дела других существ, если другое существо - не такой же дрон.\")\n\tadd_inherent_law(\"Вы не можете причинить вред ни одному существу, независимо от намерения или обстоятельств.\")\n\tadd_inherent_law(\"Вы должны заботиться о поддержке, ремонте, улучшении и о питании электроэнергией станции по мере своих возможностей.\")" } ] - }, - { - "path": "tools/translator/ss220replace.json", - "replaces": [ - { - "original": " \"files\": []", - "replace": " \"files\": [\n {\n \"path\": \"code/modules/mob/new_player/new_player.dm\",\n \"replaces\": [\n {\n \"original\": \"\\t\\treal_name = \\\"Random Character Slot\\\"\\n\\tvar/output = \\\"
Setup Character
[real_name]
Настройка персонажа
[real_name]
You are ready (Cancel)
\\\"\",\n \"replace\": \"\\t\\tif(!ready)\\toutput += \\\"\\\"\\n\\t\\telse\\toutput += \\\"Вы готовы (Отмена)
\\\"\"\n },\n {\n \"original\": \"\\t\\toutput += \\\"\\\"\\n\\t\\toutput += \\\"\\\"\",\n \"replace\": \"\\t\\toutput += \\\"\\\"\\n\\t\\toutput += \\\"\\\"\"\n },\n {\n \"original\": \"\\t\\tif(!client.skip_antag) output += \\\"Global Antag Candidacy\\\"\",\n \"replace\": \"\\t\\tif(!client.skip_antag) output += \\\"
Глобальная настройка антагов\\\"\"\n },\n {\n \"original\": \"\\t\\toutput += \\\"
You are [client.skip_antag ? \\\"ineligible\\\" : \\\"eligible\\\"] for all antag roles.
Observe (Please wait...)
\\\"\",\n \"replace\": \"\\t\\toutput += \\\"Наблюдать (Ожидайте...)
\\\"\"\n },\n {\n \"original\": \"\\t\\toutput += \\\"\\\"\",\n \"replace\": \"\\t\\toutput += \\\"\\\"\"\n },\n {\n \"original\": \"\\t\\toutput += \\\"\\\"\",\n \"replace\": \"\\t\\toutput += \\\"\\\"\"\n },\n {\n \"original\": \"\\tvar/datum/browser/popup = new(src, \\\"playersetup\\\", \\\"