mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
0311a3a1be
@ -134,8 +134,19 @@ function next(i, err) {
|
|||||||
const reactSdkFile = 'node_modules/matrix-react-sdk/src/i18n/strings/' + source + '.json';
|
const reactSdkFile = 'node_modules/matrix-react-sdk/src/i18n/strings/' + source + '.json';
|
||||||
const riotWebFile = 'src/i18n/strings/' + source + '.json';
|
const riotWebFile = 'src/i18n/strings/' + source + '.json';
|
||||||
|
|
||||||
const translations = {};
|
// XXX: Use a debounce because for some reason if we read the language
|
||||||
const makeLang = () => { genLangFile(source, dest) };
|
// file immediately after the FS event is received, the file contents
|
||||||
|
// appears empty. Possibly https://github.com/nodejs/node/issues/6112
|
||||||
|
let makeLangDebouncer;
|
||||||
|
const makeLang = () => {
|
||||||
|
if (makeLangDebouncer) {
|
||||||
|
clearTimeout(makeLangDebouncer);
|
||||||
|
}
|
||||||
|
makeLangDebouncer = setTimeout(() => {
|
||||||
|
genLangFile(source, dest);
|
||||||
|
}, 500);
|
||||||
|
};
|
||||||
|
|
||||||
[reactSdkFile, riotWebFile].forEach(function(f) {
|
[reactSdkFile, riotWebFile].forEach(function(f) {
|
||||||
chokidar.watch(f)
|
chokidar.watch(f)
|
||||||
.on('add', makeLang)
|
.on('add', makeLang)
|
||||||
@ -176,7 +187,7 @@ function genLangFile(lang, dest) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
translations = weblateToCounterpart(translations)
|
translations = weblateToCounterpart(translations);
|
||||||
|
|
||||||
fs.writeFileSync(dest + lang + '.json', JSON.stringify(translations, null, 4));
|
fs.writeFileSync(dest + lang + '.json', JSON.stringify(translations, null, 4));
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
|
Loading…
Reference in New Issue
Block a user