Skip to content

Commit

Permalink
✨ [api] add translations for einsaetze.json
Browse files Browse the repository at this point in the history
  • Loading branch information
jxn-30 committed Mar 26, 2024
1 parent b917243 commit 8004d25
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions prebuild/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,32 @@ export default async (): Promise<void> => {
const jsPath = path.join(i18nPath, `${locale}.js`);
if (!fs.existsSync(outputPath)) fs.mkdirSync(outputPath);

// read from missionHelper translations
const mhPath = path.join(
rootPath,
'src',
'modules',
'missionHelper',
'i18n',
`${locale}.json`
);
if (fs.existsSync(mhPath)) {
const mh = JSON.parse(fs.readFileSync(mhPath)?.toString() || '{}');
const specs = {
missionCategories: mh.mission_categories,
prerequisites: mh.prerequisites,
requirements: mh.vehicles.captions,
};
delete specs.missionCategories.title;
delete specs.prerequisites.title;

fs.writeFileSync(
path.join(outputPath, 'einsaetze.json'),
JSON.stringify(specs)
);
}

// read from src/i18n
const t = await getTSFile(
path.join(distI18nPath, `${locale}.js`),
jsPath
Expand Down

0 comments on commit 8004d25

Please sign in to comment.