Nightly Issues (#2618)
This commit is contained in:
parent
0ff6d4a6fc
commit
d145dca0e7
28 changed files with 138 additions and 100 deletions
24
UI/Web/hash-localization.js
Normal file
24
UI/Web/hash-localization.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
const crypto = require('crypto');
|
||||
const fs = require('fs');
|
||||
const glob = require('glob');
|
||||
|
||||
const jsonFilesDir = 'dist/browser/assets/langs/'; // Adjust the path to your JSON files
|
||||
const outputDir = 'dist/browser/assets/langs'; // Directory to store minified files
|
||||
|
||||
function generateChecksum(str, algorithm, encoding) {
|
||||
return crypto
|
||||
.createHash(algorithm || 'md5')
|
||||
.update(str, 'utf8')
|
||||
.digest(encoding || 'hex');
|
||||
}
|
||||
|
||||
const result = {};
|
||||
|
||||
glob.sync(`${jsonFilesDir}**/*.json`).forEach(path => {
|
||||
const [_, lang] = path.split('dist\\browser\\assets\\langs\\');
|
||||
const content = fs.readFileSync(path, { encoding: 'utf-8' });
|
||||
result[lang.replace('.json', '')] = generateChecksum(content);
|
||||
});
|
||||
|
||||
fs.writeFileSync('./i18n-cache-busting.json', JSON.stringify(result));
|
||||
fs.writeFileSync(`dist/browser/i18n-cache-busting.json`, JSON.stringify(result));
|
Loading…
Add table
Add a link
Reference in a new issue