From 88607703567ea487d65cf683da10cde08e8ed514 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 8 Jul 2020 11:37:27 -0400 Subject: [PATCH] feat: make the EN version just use the source translation --- scripts/translationScripts/xmlTranslator.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/translationScripts/xmlTranslator.js b/scripts/translationScripts/xmlTranslator.js index 2225be95df..d491c59853 100644 --- a/scripts/translationScripts/xmlTranslator.js +++ b/scripts/translationScripts/xmlTranslator.js @@ -18,6 +18,7 @@ tsFiles.forEach(file => { const doctype = json["_doctype"]; const language = json[doctype]._attributes.language; + const isEn = language === 'en_US' let translations; try { @@ -25,7 +26,6 @@ tsFiles.forEach(file => { } catch (e) { // No translation file for the exact match, let's use the file name instead const fileParts = file.split('_'); - console.log('Filep', fileParts); let langString = fileParts[fileParts.length - 1]; // Remove the .ts langString = langString.substring(0, langString.length - 3) @@ -39,10 +39,18 @@ tsFiles.forEach(file => { const messages = json[doctype].context.message; + console.log(`Modying ${language}...`) messages.forEach(message => { if (!message._attributes || !message._attributes.id) { return; } + if (isEn) { + // We just put the source string in the tranlsation + message.translation = { + "_text": message.source._text + } + return; + } const messageId = message._attributes.id; if (!translations[messageId]) { // Skip this message, as we have no translation @@ -58,3 +66,5 @@ tsFiles.forEach(file => { fs.writeFileSync(file, xml); }); + +console.log('All done!')