2020-10-23 13:40:39 +02:00
|
|
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
|
|
// See LICENSE.txt for license information.
|
|
|
|
|
|
|
|
import messages_en from '../i18n/en.json'
|
|
|
|
import messages_es from '../i18n/es.json'
|
2021-03-19 16:10:28 +01:00
|
|
|
import messages_de from '../i18n/de.json'
|
|
|
|
import messages_ja from '../i18n/ja.json'
|
2021-03-19 23:07:53 +01:00
|
|
|
import messages_fr from '../i18n/fr.json'
|
2021-03-21 19:47:47 +01:00
|
|
|
import messages_nl from '../i18n/nl.json'
|
|
|
|
import messages_ru from '../i18n/ru.json'
|
2020-10-23 13:40:39 +02:00
|
|
|
|
|
|
|
export function getMessages(lang: string): {[key: string]: string} {
|
|
|
|
switch (lang) {
|
2021-03-19 16:10:28 +01:00
|
|
|
case 'de':
|
|
|
|
return messages_de
|
2021-03-19 23:07:53 +01:00
|
|
|
case 'fr':
|
|
|
|
return messages_fr
|
2021-03-19 16:10:28 +01:00
|
|
|
case 'ja':
|
|
|
|
return messages_ja
|
2021-03-21 19:47:47 +01:00
|
|
|
case 'nl':
|
|
|
|
return messages_nl
|
|
|
|
case 'ru':
|
|
|
|
return messages_ru
|
2020-10-23 13:40:39 +02:00
|
|
|
case 'es':
|
|
|
|
return messages_es
|
|
|
|
}
|
|
|
|
return messages_en
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getCurrentLanguage(): string {
|
|
|
|
let lang = localStorage.getItem('language')
|
|
|
|
if (!lang) {
|
|
|
|
lang = navigator.language.split(/[-_]/)[0]
|
|
|
|
}
|
|
|
|
return lang
|
|
|
|
}
|
|
|
|
|
|
|
|
export function storeLanguage(lang: string): void {
|
|
|
|
localStorage.setItem('language', lang)
|
|
|
|
}
|