Created
November 7, 2022 09:41
-
-
Save EdgardoRodriguezSolano/8197caa2e61295aaf3745e02eaf487c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs-extra'); | |
const { languages } = require('../config'); | |
for (let i = 0; i < languages.length; i++) { | |
const languageAbbreviation = languages[i]; | |
const dir = `src/sdk/ui/common/locale/gdpr/${languageAbbreviation}`; | |
webData = fs.readFileSync( | |
`src/sdk/ui/gdpr/locale/${languageAbbreviation}/onesky.json`, | |
'utf8', | |
); | |
const webObject = JSON.parse(webData); | |
ctvData = fs.readFileSync( | |
`src/sdk/ui/ctv/locale/${languageAbbreviation}/onesky.json`, | |
'utf8', | |
); | |
const ctvObject = JSON.parse(ctvData); | |
const mergedTranslations = { ...webObject, ...ctvObject }; | |
try { | |
fs.mkdirSync(`${dir}`, { recursive: true }); | |
fs.writeFileSync(`${dir}/onesky.json`, JSON.stringify(mergedTranslations)); | |
} catch (err) { | |
console.error( | |
`Web : An error Error while trying to create the onesky.json file for the language ${languageAbbreviation}`, | |
err, | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment