Rocket.Chat.ReactNative/app/i18n/index.js

34 lines
818 B
JavaScript
Raw Normal View History

import i18n from 'i18n-js';
import { I18nManager } from 'react-native';
import * as RNLocalize from 'react-native-localize';
2018-06-01 17:38:13 +00:00
import en from './locales/en';
import ru from './locales/ru';
2019-02-14 15:40:41 +00:00
import fr from './locales/fr';
2019-02-21 17:17:03 +00:00
import de from './locales/de';
2020-02-07 13:04:46 +00:00
import nl from './locales/nl';
import ptBR from './locales/pt-BR';
import zhCN from './locales/zh-CN';
2019-03-18 19:09:40 +00:00
import ptPT from './locales/pt-PT';
2018-06-01 17:38:13 +00:00
i18n.translations = {
en,
ru,
'pt-BR': ptBR,
'zh-CN': zhCN,
fr,
de,
2020-02-07 13:04:46 +00:00
'pt-PT': ptPT,
nl
2018-06-01 17:38:13 +00:00
};
i18n.fallbacks = true;
const defaultLanguage = { languageTag: 'en', isRTL: false };
const availableLanguages = Object.keys(i18n.translations);
const { languageTag, isRTL } = RNLocalize.findBestAvailableLanguage(availableLanguages) || defaultLanguage;
I18nManager.forceRTL(isRTL);
i18n.locale = languageTag;
2018-06-01 17:38:13 +00:00
export default i18n;