snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
This commit is contained in:
38
lang/update-translation.js
Normal file
38
lang/update-translation.js
Normal file
@@ -0,0 +1,38 @@
|
||||
/* eslint-disable */
|
||||
|
||||
const fs = require('fs');
|
||||
const process = require('process');
|
||||
const traverse = require('traverse');
|
||||
const mainLang = require('./main.json');
|
||||
|
||||
const [ targetLangFile ] = process.argv.slice(-1);
|
||||
|
||||
if (!targetLangFile) {
|
||||
console.log('No target language file specified');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const targetLang = require(`./${targetLangFile}`);
|
||||
|
||||
const paths = traverse(mainLang).reduce(function(acc, item) {
|
||||
if (this.isLeaf) {
|
||||
acc.push(this.path);
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, []);
|
||||
|
||||
const result = {};
|
||||
|
||||
for (const path of paths) {
|
||||
if (traverse(targetLang).has(path)) {
|
||||
traverse(result).set(path, traverse(targetLang).get(path));
|
||||
} else {
|
||||
//console.log(`${path.join('.')} is missing`);
|
||||
traverse(result).set(path, '');
|
||||
}
|
||||
}
|
||||
|
||||
const data = JSON.stringify(result, undefined, 4);
|
||||
|
||||
fs.writeFileSync(`./${targetLangFile}`, data + "\n");
|
||||
Reference in New Issue
Block a user