diff --git a/Utils.ts b/Utils.ts index 3fa4c6fb1..b9f98c18d 100644 --- a/Utils.ts +++ b/Utils.ts @@ -546,9 +546,10 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be /** * Walks the specified path into the object till the end. * - * If a list is encountered, this is tranparently walked recursively on every object. + * If a list is encountered, this is transparently walked recursively on every object. + * If 'null' or 'undefined' is encountered, this method stops * - * The leaf objects are replaced in the object itself by the specified function + * The leaf objects are replaced in the object itself by the specified function. */ public static WalkPath( path: string[], @@ -569,6 +570,9 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be object[head] = leaf.map((o) => replaceLeaf(o, travelledPath)) } else { object[head] = replaceLeaf(leaf, travelledPath) + if(object[head] === undefined){ + delete object[head] + } } } return diff --git a/langs/cs.json b/langs/cs.json index d0b5de1ab..43c907a64 100644 --- a/langs/cs.json +++ b/langs/cs.json @@ -77,9 +77,7 @@ "donate": "Podpořte MapComplete finančně", "editId": "Zde otevřete online editor OpenStreetMap", "editJosm": "Upravit zde pomocí JOSM", - "followBridge": "Účty Mastodon a Twitter jsou propojeny", "followOnMastodon": "Sledujte MapComplete na Mastodonu", - "followOnTwitter": "Sledujte MapComplete na Twitteru", "iconAttribution": { "title": "Použité ikony" }, diff --git a/langs/da.json b/langs/da.json index da4ecf1bf..5d28edba5 100644 --- a/langs/da.json +++ b/langs/da.json @@ -83,7 +83,6 @@ "editId": "Åben OpenStreetMap onlineeditoren her", "editJosm": "Rediger her med JOSM", "followOnMastodon": "Følg MapComplete på Mastodon", - "followOnTwitter": "Følg MapComplete på Twitter", "iconAttribution": { "title": "Brugte ikoner" }, diff --git a/langs/de.json b/langs/de.json index 677ec1095..23a8bc8aa 100644 --- a/langs/de.json +++ b/langs/de.json @@ -124,9 +124,7 @@ "donate": "MapComplete finanziell unterstützen", "editId": "Den OpenStreetMap Editor öffnen", "editJosm": "Mit JOSM bearbeiten", - "followBridge": "Die Mastodon- und Twitter-Konten werden überbrückt", "followOnMastodon": "MapComplete auf Mastodon folgen", - "followOnTwitter": "MapComplete auf Twitter folgen", "iconAttribution": { "title": "Verwendete Symbole" }, diff --git a/langs/es.json b/langs/es.json index d1a40606e..2e0eff6ea 100644 --- a/langs/es.json +++ b/langs/es.json @@ -82,9 +82,7 @@ "donate": "Apoya a MapComplete de manera financiera", "editId": "Abre el editor en línea de OpenStreetMap aquí", "editJosm": "Edita aquí conJOSM", - "followBridge": "Las cuentas de Mastodon y Twitter están puenteadas", "followOnMastodon": "Seguir a MapComplete en Mastodon", - "followOnTwitter": "Seguir a MapComplete en twitter", "iconAttribution": { "title": "Iconos usados" }, diff --git a/langs/fr.json b/langs/fr.json index 32921201b..156b17073 100644 --- a/langs/fr.json +++ b/langs/fr.json @@ -90,9 +90,7 @@ "donate": "Soutenez MapComplete financièrement", "editId": "Ouvrir l’éditeur en ligne OpenStreetMap ici", "editJosm": "Modifier ici avec JOSM", - "followBridge": "Les comptes Mastodon et Twitter sont liés", "followOnMastodon": "Suivez MapComplete sur Mastodon", - "followOnTwitter": "Suivez MapComplete sur Twitter", "iconAttribution": { "title": "Icônes utilisées" }, diff --git a/langs/hu.json b/langs/hu.json index 56ba8f4b2..c031eadb4 100644 --- a/langs/hu.json +++ b/langs/hu.json @@ -80,9 +80,7 @@ "donate": "A MapComplete pénzügyi támogatása", "editId": "Az OpenStreetMap online szerkesztőjének megnyitása itt", "editJosm": "Szerkesztés itt JOSM-mal", - "followBridge": "A Mastodon- és Twitter-fiókok összekapcsolódnak", "followOnMastodon": "Kövesse a MapComplete-et a Mastodonon", - "followOnTwitter": "Kövesse a MapComplete-et a Twitteren", "iconAttribution": { "title": "Felhasznált ikonok" }, diff --git a/langs/id.json b/langs/id.json index 3e3546553..68314a745 100644 --- a/langs/id.json +++ b/langs/id.json @@ -65,9 +65,7 @@ "donate": "Dukung MapComplete secara finansial", "editId": "Buka penyunting daring OpenStreetMap di sini", "editJosm": "Sunting di sini dengan JOSM", - "followBridge": "Akun Mastodon dan Twitter dijembatani", "followOnMastodon": "Ikuti MapComplete di Mastodon", - "followOnTwitter": "Ikuti MapComplete di Twitter", "iconAttribution": { "title": "Ikon yang digunakan" }, diff --git a/langs/it.json b/langs/it.json index 0037c7fd5..fb2eb082f 100644 --- a/langs/it.json +++ b/langs/it.json @@ -83,9 +83,7 @@ "donate": "Sostieni MapComplete economicamente", "editId": "Apri l'editor online di OpenStreetMap qui", "editJosm": "Modifica qui con JOSM", - "followBridge": "Gli account Mastodon e Twitter sono collegati", "followOnMastodon": "Segui MapComplete su Mastodon", - "followOnTwitter": "Segui MapComplete su Twitter", "iconAttribution": { "title": "Icone utilizzate" }, @@ -416,4 +414,4 @@ "split": "Dividi", "splitTitle": "Scegli sulla cartina il punto dove vuoi dividere la strada" } -} \ No newline at end of file +} diff --git a/langs/nb_NO.json b/langs/nb_NO.json index 030fb5712..5caa2a5a0 100644 --- a/langs/nb_NO.json +++ b/langs/nb_NO.json @@ -81,7 +81,6 @@ "editId": "Åpne den nettbaserte OpenStreetMap-behandleren her", "editJosm": "Rediger med JOSM", "followOnMastodon": "Følg MapComplete på Mastodon", - "followOnTwitter": "Følg MapComplete på Twitter", "iconAttribution": { "title": "Brukte ikoner" }, diff --git a/langs/nl.json b/langs/nl.json index 16f0d2b51..a7db1b558 100644 --- a/langs/nl.json +++ b/langs/nl.json @@ -124,9 +124,7 @@ "donate": "Geef MapComplete financiële steun", "editId": "Hier bewerken met de OpenStreetMap online editor", "editJosm": "Hier bewerken met JOSM", - "followBridge": "De Mastodon- en Twitter-accounts worden gesynchronizeerd", "followOnMastodon": "Volg MapComplete op Mastodon", - "followOnTwitter": "Volg MapComplete op Twitter", "iconAttribution": { "title": "Iconen en afbeeldingen" }, diff --git a/langs/pt.json b/langs/pt.json index 6a274f240..f9e0afeaa 100644 --- a/langs/pt.json +++ b/langs/pt.json @@ -83,9 +83,7 @@ "donate": "Apoie o MapComplete financeiramente", "editId": "Editar aqui com o editor online OpenStreetMap", "editJosm": "Editar aqui com JOSM", - "followBridge": "As contas Mastodon e Twitter estão interligadas", "followOnMastodon": "Siga o MapComplete no Mastodon", - "followOnTwitter": "Siga o MapComplete no Twitter", "iconAttribution": { "title": "Ícones usados" }, diff --git a/langs/zh_Hant.json b/langs/zh_Hant.json index e6b6f5215..04c8e3a62 100644 --- a/langs/zh_Hant.json +++ b/langs/zh_Hant.json @@ -89,9 +89,7 @@ "donate": "財務上支援 MapComplete", "editId": "開啟開放街圖線上編輯器", "editJosm": "採用 JOSM 編輯", - "followBridge": "已經連結 Mastodon 與 Twitter 帳號", "followOnMastodon": "在 Mastodon 追蹤 MapComplete", - "followOnTwitter": "在 Twitter 追蹤 MapComplete", "iconAttribution": { "title": "使用的圖示" }, diff --git a/scripts/removeTranslationString.ts b/scripts/removeTranslationString.ts new file mode 100644 index 000000000..30c9bf60a --- /dev/null +++ b/scripts/removeTranslationString.ts @@ -0,0 +1,25 @@ +import ScriptUtils from "./ScriptUtils"; +import {Utils} from "../Utils"; +import * as fs from "fs" + +async function main(args: string[]){ + if(args.length !== 1){ + console.log("Usage: first argument is the fully qualified key of the string to remove") + return + } + const path = args[0].split(".") + console.log("Removing translation string ", path, 'from the general translations') + const files = ScriptUtils.readDirRecSync("./langs", 1).filter(f => f.endsWith(".json")) + for (const file of files) { + const json = JSON.parse(fs.readFileSync(file, "UTF-8")) + Utils.WalkPath(path, json, (_ => undefined)) + fs.writeFileSync(file, JSON.stringify(json, null, " ")+"\n") + } +} + + +const args = [...process.argv] +args.splice(0, 2) +main(args).then((_) => { + console.log("All done!") +})