From b113d53f15ec525995d8d46a655bb4263264d354 Mon Sep 17 00:00:00 2001 From: Joel Calado Date: Sat, 27 Mar 2021 19:39:27 +0000 Subject: [PATCH] Update ci-generateTranslations.js --- .github/ci-generateTranslations.js | 62 ++++++++++++++---------------- 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/.github/ci-generateTranslations.js b/.github/ci-generateTranslations.js index 12b21d4..f78062e 100644 --- a/.github/ci-generateTranslations.js +++ b/.github/ci-generateTranslations.js @@ -127,41 +127,35 @@ combinedTrans.placeholders = defaultTransPlaceholders; var counter = 0; for (const i in updateList) { const lang = updateList[i]; - setTimeout( - (ln) => { - var suceess = updateTranslation(ln); // we don't need to worry about DATA. - updateTranslation(ln).then(function (suceess) { - const newTrans = suceess[1]["innerHTML"]; - //const allItems = document.querySelectorAll('[data-translate]'); - allItems.forEach((ele) => { - const key = ele.dataset.translate; //.replace(/[\W]+/g, "-").toLowerCase(); - newTrans[key] = ele.innerHTML; - }); - const newTransTitles = suceess[1]["titles"]; - //const allTitles = document.querySelectorAll('[title]'); - allTitles.forEach((ele) => { - const key = ele.dataset.key; - newTransTitles[key] = ele.title; - }); + var translation = updateTranslation(lang); // we don't need to worry about DATA. + updateTranslation(lang).then(function (translation) { + const newTrans = translation[1]["innerHTML"]; + //const allItems = document.querySelectorAll('[data-translate]'); + allItems.forEach((ele) => { + const key = ele.dataset.translate; //.replace(/[\W]+/g, "-").toLowerCase(); + newTrans[key] = ele.innerHTML; + }); - const newPlaceholders = suceess[1]["placeholders"]; - // const allPlaceholders = document.querySelectorAll('[placeholder]'); - allPlaceholders.forEach((ele) => { - const key = ele.dataset.key; - newPlaceholders[key] = ele.placeholder; - }); + const newTransTitles = translation[1]["titles"]; + //const allTitles = document.querySelectorAll('[title]'); + allTitles.forEach((ele) => { + const key = ele.dataset.key; + newTransTitles[key] = ele.title; + }); - // //// DOWNLOAD UPDATED TRANSLATION - const outputTrans = {}; - outputTrans["titles"] = newTransTitles; - outputTrans["innerHTML"] = newTrans; - outputTrans["placeholders"] = newPlaceholders; - downloadTranslation(ln, outputTrans); - }); - }, - counter, - lang - ); - counter += 800; + const newPlaceholders = translation[1]["placeholders"]; + // const allPlaceholders = document.querySelectorAll('[placeholder]'); + allPlaceholders.forEach((ele) => { + const key = ele.dataset.key; + newPlaceholders[key] = ele.placeholder; + }); + + // //// DOWNLOAD UPDATED TRANSLATION + const outputTrans = {}; + outputTrans["titles"] = newTransTitles; + outputTrans["innerHTML"] = newTrans; + outputTrans["placeholders"] = newPlaceholders; + downloadTranslation(lang, outputTrans); + }); }