Skip to content

Commit e380be5

Browse files
authored
Fix translation paths (#672)
* Fix translation paths * Actually fix it
1 parent 0ef92e2 commit e380be5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

script/gulp/translations.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function recursiveFlatten(prefix, data) {
2323
...recursiveFlatten(prefix + key + ".", data[key]),
2424
};
2525
} else {
26-
output[prefix + key] = data[key].replace(/'{/g, "''{").replace(/}'/g, "}''");
26+
output[prefix + key] = String(data[key]).replace(/'{/g, "''{").replace(/}'/g, "}''");
2727
}
2828
});
2929
return Object.fromEntries(Object.entries(output).sort());
@@ -37,21 +37,21 @@ gulp.task("generate-translations", async function (task) {
3737
);
3838

3939
for (const language of fs.readdirSync(paths.translations_src)) {
40-
if (ignoredLanguages.has(language)) continue;
4140
const lang = language.split(".")[0];
42-
const fileName = lang in changeLang ? changeLang[lang] : lang;
41+
if (ignoredLanguages.has(language)) continue;
42+
const fileName = `${lang in changeLang ? changeLang[lang] : lang}.json`;
4343
const translation = { ...defaultTranslation };
44-
if (language !== "en" && fs.existsSync(`${paths.translations_src}/${fileName}`)) {
44+
if (lang !== "en" && fs.existsSync(`${paths.translations_src}/${language}`)) {
4545
const fileTranslations = recursiveFlatten(
4646
"",
47-
fs.readJSONSync(`${paths.translations_src}/${fileName}`, "utf-8")
47+
fs.readJSONSync(`${paths.translations_src}/${language}`, "utf-8")
4848
);
4949
for (const key of Object.keys(fileTranslations)) {
5050
translation[key] = fileTranslations[key];
5151
}
5252
}
5353
await fs.writeFile(
54-
`${paths.build_dir}/translations/${language}`,
54+
`${paths.build_dir}/translations/${fileName}`,
5555
JSON.stringify(translation, null),
5656
"utf-8"
5757
);

0 commit comments

Comments
 (0)