From 8004d256aab97c887857dcc6d7d5ed983a02e5e8 Mon Sep 17 00:00:00 2001 From: jan Date: Tue, 26 Mar 2024 13:55:22 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20[api]=20add=20translations=20for=20?= =?UTF-8?q?einsaetze.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prebuild/api.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/prebuild/api.ts b/prebuild/api.ts index 8614e529d1..e50bf1dd77 100644 --- a/prebuild/api.ts +++ b/prebuild/api.ts @@ -55,6 +55,32 @@ export default async (): Promise => { 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