diff options
author | 2024-12-30 09:07:46 +0000 | |
---|---|---|
committer | 2024-12-30 09:07:46 +0000 | |
commit | 50eb8b0cb80815125a1534d0215c37555aae5be1 (patch) | |
tree | c507bfb591b7c2fbe9306842626ab4342a203148 /usecaseui-portal/merge-i18n.js | |
parent | 9df997b6d974f0942d57966fc2986e59d95837dd (diff) | |
parent | 4f2ee468370622d8e45382087f0599032b9afeba (diff) |
Merge "Optimize your code and add editing capabilities for your knowledge base and apps."
Diffstat (limited to 'usecaseui-portal/merge-i18n.js')
-rw-r--r-- | usecaseui-portal/merge-i18n.js | 18 |
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 |