Skip to content

Instantly share code, notes, and snippets.

@EdgardoRodriguezSolano
Created November 7, 2022 09:41
Show Gist options
  • Save EdgardoRodriguezSolano/8197caa2e61295aaf3745e02eaf487c3 to your computer and use it in GitHub Desktop.
Save EdgardoRodriguezSolano/8197caa2e61295aaf3745e02eaf487c3 to your computer and use it in GitHub Desktop.
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