Commit f168b4da authored by LAVENIER's avatar LAVENIER
Browse files

[fix] Fix compilation error (add build-i18n.js)

parent f15fd38c
Pipeline #12789 failed with stages
in 5 minutes and 58 seconds
......@@ -14,7 +14,7 @@
"build": "ng build",
"build.dev": "ng build --configuration development",
"build.prod": "ng build --configuration production && npm run build.i18n",
"build.i18n": "node scripts/build-i18n.js",
"build.i18n": "node scripts/node/build-i18n.js",
"test": "ng test",
"lint": "ng lint"
},
......
'use strict';
const { join } = require('path');
const { readdirSync, readFileSync, copyFileSync } = require('fs');
const i18nDir = './www/assets/i18n/';
let pkgStr = readFileSync('./package.json', {encoding: 'UTF-8'});
const pkg = JSON.parse(pkgStr);
console.debug('Insert version into I18n files...');
// For each files
readdirSync(i18nDir)
// Filter in src i18n files (skip renamed files)
.filter(file => file.match(/^[a-z]{2}(-[A-Z]{2})?\.json$/))
.forEach(file => {
const filePath = join(i18nDir, file);
const newFilePath = join(i18nDir, file.replace(/([a-z]{2}(:?-[A-Z]{2})?)\.json/, '$1-' + pkg.version + '.json'));
console.debug(' - ' + filePath + ' -> ' + newFilePath);
copyFileSync(filePath, newFilePath, );
});
console.debug('Insert version into I18n files [OK]');
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment