verdnatura-chat/app/i18n/index.js

40 lines
942 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';
2020-02-10 20:05:58 +00:00
import esES from './locales/es-ES';
2020-02-17 16:59:31 +00:00
import it from './locales/it';
import ja from './locales/ja';
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,
2020-02-10 20:05:58 +00:00
'es-ES': esES,
2020-02-17 16:59:31 +00:00
nl,
it,
ja
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;