From fc432430f6d63b64f6b5b10c1f682ee75a3f4eb5 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Tue, 15 Dec 2020 13:38:18 -0800 Subject: [PATCH] Agent translation fixes. --- agents/agent-translations.json | 82 ---------------------------------- translate/translate.js | 6 ++- 2 files changed, 4 insertions(+), 84 deletions(-) diff --git a/agents/agent-translations.json b/agents/agent-translations.json index 44e0f94a..36e48659 100644 --- a/agents/agent-translations.json +++ b/agents/agent-translations.json @@ -177,87 +177,5 @@ "connect": "連接", "disconnect": "斷線", "cancel": "取消" - }, - "xloc": { - "agent": [ - "agent-translations.json" - ], - "agentVersion": [ - "agent-translations.json" - ], - "group": [ - "agent-translations.json" - ], - "url": [ - "agent-translations.json" - ], - "meshName": [ - "agent-translations.json" - ], - "meshId": [ - "agent-translations.json" - ], - "serverId": [ - "agent-translations.json" - ], - "setup": [ - "agent-translations.json" - ], - "update": [ - "agent-translations.json" - ], - "install": [ - "agent-translations.json" - ], - "uninstall": [ - "agent-translations.json" - ], - "connect": [ - "agent-translations.json" - ], - "disconnect": [ - "agent-translations.json" - ], - "cancel": [ - "agent-translations.json" - ], - "pressok": [ - "agent-translations.json" - ], - "elevation": [ - "agent-translations.json" - ], - "sudo": [ - "agent-translations.json" - ], - "ctrlc": [ - "agent-translations.json" - ], - "commands": [ - "agent-translations.json" - ], - "graphicalerror": [ - "agent-translations.json" - ], - "zenity": [ - "agent-translations.json" - ], - "status": [ - [ - "agent-translations.json" - ], - [ - "agent-translations.json" - ], - [ - "agent-translations.json" - ] - ], - "statusDescription": [ - "agent-translations.json" - ], - "description": [ - "agent-translations.json" - ] } } \ No newline at end of file diff --git a/translate/translate.js b/translate/translate.js index 4dfc42cd..ad228eb4 100644 --- a/translate/translate.js +++ b/translate/translate.js @@ -668,7 +668,9 @@ function extractFromJson(file) { const str = json.en[i] if (sourceStrings[str] == null) { sourceStrings[str] = { en: str, xloc: [name] }; - } else { if (sourceStrings[str].xloc == null) { sourceStrings[str].xloc = []; } sourceStrings[str].xloc.push(name); } + } else { + if (sourceStrings[str].xloc == null) { sourceStrings[str].xloc = []; } sourceStrings[str].xloc.push(name); + } } else if (Array.isArray(json.en[i])) { for (var k in json.en[i]) { if (typeof json.en[i][k] == 'string') { @@ -794,7 +796,7 @@ function translateAllInJson(xlang, langFile, file) { for (var i in langFileData.strings) { var entry = langFileData.strings[i]; for (var lang in entry) { - if (lang == 'en') continue; + if ((lang == 'en') || (lang == 'xloc')) continue; if ((xlang != null) && (lang != xlang)) continue; if (languages.indexOf(lang) == -1) { languages.push(lang); xtranslationTable[lang] = {}; } if ((entry['en'] != null) && (entry[lang] != null)) { xtranslationTable[lang][entry['en']] = entry[lang]; }