From 1f3f7af1e1301f54be09eb2f38ca3e6b37458394 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 4 Sep 2017 17:16:13 +0100 Subject: [PATCH] Revert accidental merge --- scripts/copy-res.js | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/scripts/copy-res.js b/scripts/copy-res.js index ac3daf60..fa52492e 100755 --- a/scripts/copy-res.js +++ b/scripts/copy-res.js @@ -156,7 +156,7 @@ function genLangFile(lang, dest) { const reactSdkFile = 'node_modules/matrix-react-sdk/src/i18n/strings/' + lang + '.json'; const riotWebFile = 'src/i18n/strings/' + lang + '.json'; - let translations = {}; + const translations = {}; [reactSdkFile, riotWebFile].forEach(function(f) { if (fs.existsSync(f)) { Object.assign( @@ -165,9 +165,6 @@ function genLangFile(lang, dest) { ); } }); - - translations = weblateToCounterpart(translations) - fs.writeFileSync(dest + lang + '.json', JSON.stringify(translations, null, 4)); if (verbose) { console.log("Generated language file: " + lang); @@ -196,39 +193,5 @@ function genLangList() { } } -/** - * Convert translation key from weblate format - * (which only supports a single level) to counterpart - * which requires object values for 'count' translations. - * - * eg. - * "there are %(count)s badgers|one": "a badger", - * "there are %(count)s badgers|other": "%(count)s badgers" - * becomes - * "there are %(count)s badgers": { - * "one": "a badger", - * "other": "%(count)s badgers" - * } - */ -function weblateToCounterpart(inTrs) { - const outTrs = {}; - - for (const key of Object.keys(inTrs)) { - const keyParts = key.split('|', 2); - if (keyParts.length === 2) { - let obj = outTrs[keyParts[0]]; - if (obj === undefined) { - obj = {}; - outTrs[keyParts[0]] = obj; - } - obj[keyParts[1]] = inTrs[key]; - } else { - outTrs[key] = inTrs[key]; - } - } - - return outTrs; -} - genLangList(); next(0);