blob: b568d34d2e41f5e6d29eb908713e8f36d52825e0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
import LanguageTags from '../src/platform/generic/_locales/en/messages.json';
import LanguageTagsDe from '../src/platform/generic/_locales/de/messages.json';
import LanguageTagsIt from '../src/platform/generic/_locales/it/messages.json';
import fs from 'fs';
import path from 'path';
let languages = {
de: LanguageTagsDe,
it: LanguageTagsIt
},
changes = {};
for(let tag in LanguageTags) {
if(!LanguageTags.hasOwnProperty(tag)) continue;
let languageTag = LanguageTags[tag];
if(!languageTag.hasOwnProperty('description') || languageTag.description.length === 0) continue;
for(let language in languages) {
if(!languages.hasOwnProperty(language)) continue;
if(!languages[language].hasOwnProperty(tag)) continue;
let translation = languages[language][tag];
if(!translation.hasOwnProperty('description') || translation.description.length === 0 || translation.description !== languageTag.description) {
translation.description = languageTag.description;
changes[language] = true;
}
if(languageTag.hasOwnProperty('placeholders') && (translation.hasOwnProperty('placeholders') || JSON.stringify(languageTag.placeholders) !== JSON.stringify(translation.placeholders))) {
translation.placeholders = languageTag.placeholders;
changes[language] = true;
}
}
}
for(let language in changes) {
if(!changes.hasOwnProperty(language) || !languages.hasOwnProperty(language)) continue;
let data = JSON.stringify(languages[language], null, 4),
file = path.resolve(`src/platform/generic/_locales/${language}/messages.json`);
fs.writeFileSync(file, data);
}
|