Mercurial > gemma
annotate client/src/locale/languages.js @ 5082:c4ebb6ccc588 time-sliding
client: start a request for the last changed time on time slider
* initiate a refresh layers request when the time for the
finished request differs from the selected time on time slider
author | Fadi Abbud <fadi.abbud@intevation.de> |
---|---|
date | Wed, 18 Mar 2020 14:11:44 +0100 |
parents | 24e3e86b8cb6 |
children |
rev | line source |
---|---|
2386
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
1 import * as browserLanguage from "locale2"; |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
2 |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
3 // planned also RS, BiH, UA |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
4 const supportedLanguages = { |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
5 en_GB: "British English", |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
6 de_AT: "Deutsch", |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
7 sk_SK: "slovenčina", |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
8 hu_HU: "Magyar", |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
9 hr_HR: "Hrvatska", |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
10 bg_BG: "български", |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
11 ro_RO: "Română" |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
12 }; |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
13 |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
14 let isAvailableLanguage = Object.keys(supportedLanguages).filter(language => { |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
15 return browserLanguage.replace("-", "_") === language; |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
16 }); |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
17 |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
18 if (isAvailableLanguage.length === 0) { |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
19 isAvailableLanguage = Object.keys(supportedLanguages).filter(language => { |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
20 return language.substr(0, 2) === browserLanguage.substr(0, 2); |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
21 }); |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
22 } |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
23 |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
24 let defaultLanguage = |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
25 isAvailableLanguage.length > 0 ? isAvailableLanguage[0] : "en_GB"; |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
26 |
24e3e86b8cb6
client: moved i18n configuration to own file
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
27 export { supportedLanguages, defaultLanguage }; |