Skip to content

Commit 33cf39e

Browse files
dtygel-gitara4n
authored andcommitted
Add language picker labels (element-hq#4141)
* fix after rebase * add string to translate in messagecontextmenu * add labels for language picker
1 parent 81ea384 commit 33cf39e

1 file changed

Lines changed: 14 additions & 15 deletions

File tree

‎scripts/copy-res.js‎

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,16 @@
99
// This could readily be automated, but it's nice to explicitly
1010
// control when we languages are available.
1111
const INCLUDE_LANGS = [
12-
//'be' Omitted because no translations in react-sdk
13-
'en_EN',
14-
'da',
15-
'de_DE',
16-
'es',
17-
'fr',
18-
'be',
19-
'nl',
20-
'pt',
21-
'pt_BR',
22-
'ru',
12+
{'value': 'en_EN', 'label': 'English'},
13+
{'value': 'da', 'label': 'Dansk'},
14+
{'value': 'nl', 'label': 'Nederlands'},
15+
{'value': 'de_DE', 'label': 'Deutsch'},
16+
{'value': 'fr', 'label': 'Français'},
17+
{'value': 'pt', 'label': 'Português'},
18+
{'value': 'pt_BR', 'label': 'Português do Brasil'},
19+
{'value': 'ru', 'label': 'Русский'},
20+
{'value': 'es', 'label': 'Español'},
21+
{'value': 'zh_Hans', 'label': '中文'}
2322
];
2423

2524
// cpx includes globbed parts of the filename in the destination, but excludes
@@ -37,7 +36,7 @@ const COPY_LIST = [
3736

3837
INCLUDE_LANGS.forEach(function(l) {
3938
COPY_LIST.push([
40-
l, "webapp/i18n/", { lang: 1 },
39+
l.value, "webapp/i18n/", { lang: 1 },
4140
]);
4241
});
4342

@@ -159,12 +158,12 @@ function genLangFile(lang, dest) {
159158
function genLangList() {
160159
const languages = {};
161160
INCLUDE_LANGS.forEach(function(lang) {
162-
const normalizedLanguage = lang.toLowerCase().replace("_", "-");
161+
const normalizedLanguage = lang.value.toLowerCase().replace("_", "-");
163162
const languageParts = normalizedLanguage.split('-');
164163
if (languageParts.length == 2 && languageParts[0] == languageParts[1]) {
165-
languages[languageParts[0]] = lang + '.json';
164+
languages[languageParts[0]] = {'fileName': lang.value + '.json', 'label': lang.label};
166165
} else {
167-
languages[normalizedLanguage] = lang + '.json';
166+
languages[normalizedLanguage] = {'fileName': lang.value + '.json', 'label': lang.label};
168167
}
169168
});
170169
fs.writeFile('webapp/i18n/languages.json', JSON.stringify(languages, null, 4));

0 commit comments

Comments
 (0)