summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/merge-i18n.js
diff options
context:
space:
mode:
Diffstat (limited to 'usecaseui-portal/merge-i18n.js')
-rw-r--r--usecaseui-portal/merge-i18n.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/usecaseui-portal/merge-i18n.js b/usecaseui-portal/merge-i18n.js
new file mode 100644
index 00000000..939dd336
--- /dev/null
+++ b/usecaseui-portal/merge-i18n.js
@@ -0,0 +1,18 @@
+const fs = require('fs');
+const path = require('path');
+
+const i18nDir = path.join(__dirname, 'src/assets', 'i18n');
+['en', 'cn'].forEach(file_prefix => {
+ const jsonPath = path.join(i18nDir, file_prefix + '.json');
+ fs.writeFileSync(jsonPath, '{}');
+ let json = {};
+ fs.readdirSync(i18nDir)
+ .filter(file => file.startsWith(file_prefix + '_') && file.endsWith('.json'))
+ .forEach(file => {
+ const filePath = path.join(i18nDir, file);
+ const fileContent = JSON.parse(fs.readFileSync(filePath, 'utf8'));
+ json = { ...json, ...fileContent };
+ });
+
+ fs.writeFileSync(jsonPath, JSON.stringify(json, null, 2));
+}) \ No newline at end of file