mirror of
https://github.com/koodo-reader/koodo-reader.git
synced 2026-10-06 12:53:52 -04:00
fix: update i18n script to handle missing terms and write to target locales
This commit is contained in:
1 parent
b2eec07ddc
commit
3a3fd2a88b
1 file changed
+10
-5
+10
-5
@@ -9,6 +9,12 @@ for (let index = 0; index < folders.length; index++) {
|
||||
resources.push(`../src/assets/locales/${folder}`);
|
||||
}
|
||||
console.info(resources);
|
||||
let targets = [];
|
||||
for (let index = 0; index < folders.length; index++) {
|
||||
const folder = folders[index];
|
||||
targets.push(`../scripts/locales/${folder}`);
|
||||
}
|
||||
console.info(targets);
|
||||
|
||||
// find the missing terms in the english
|
||||
const zhdataRaw = fs.readFileSync(
|
||||
@@ -62,12 +68,11 @@ for (let index = 0; index < resources.length; index++) {
|
||||
missingTerms[term] = referData[term];
|
||||
}
|
||||
}
|
||||
// console.info(missingTerms);
|
||||
const mergedObj = Object.assign({}, targetData, missingTerms);
|
||||
|
||||
console.info(missingTerms);
|
||||
const target = targets[index];
|
||||
fs.writeFileSync(
|
||||
path.join(__dirname, resource),
|
||||
JSON.stringify(mergedObj, null, 2)
|
||||
path.join(__dirname, target),
|
||||
JSON.stringify(missingTerms, null, 2)
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("Error reading JSON file:", error);
|
||||
|
||||
Reference in new issue
Block a user