Mercurial > gemma
view client/src/locale/languages.js @ 2887:83acca8937de
client: importoverview: improved log style
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Mon, 01 Apr 2019 18:53:53 +0200 |
parents | 24e3e86b8cb6 |
children |
line wrap: on
line source
import * as browserLanguage from "locale2"; // planned also RS, BiH, UA const supportedLanguages = { en_GB: "British English", de_AT: "Deutsch", sk_SK: "slovenčina", hu_HU: "Magyar", hr_HR: "Hrvatska", bg_BG: "български", ro_RO: "Română" }; let isAvailableLanguage = Object.keys(supportedLanguages).filter(language => { return browserLanguage.replace("-", "_") === language; }); if (isAvailableLanguage.length === 0) { isAvailableLanguage = Object.keys(supportedLanguages).filter(language => { return language.substr(0, 2) === browserLanguage.substr(0, 2); }); } let defaultLanguage = isAvailableLanguage.length > 0 ? isAvailableLanguage[0] : "en_GB"; export { supportedLanguages, defaultLanguage };