2019-07-16 14:30:29 +00:00
|
|
|
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';
|
2018-07-25 13:14:12 +00:00
|
|
|
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';
|
2018-09-27 11:43:19 +00:00
|
|
|
import ptBR from './locales/pt-BR';
|
2018-10-24 19:10:44 +00:00
|
|
|
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
|
|
|
|
2019-07-16 14:30:29 +00:00
|
|
|
i18n.translations = {
|
|
|
|
en,
|
|
|
|
ru,
|
|
|
|
'pt-BR': ptBR,
|
|
|
|
'zh-CN': zhCN,
|
|
|
|
fr,
|
|
|
|
de,
|
|
|
|
'pt-PT': ptPT
|
2018-06-01 17:38:13 +00:00
|
|
|
};
|
2019-07-16 14:30:29 +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
|
|
|
|
2019-07-16 14:30:29 +00:00
|
|
|
export default i18n;
|