nostros/frontend/i18n.config.ts
2022-12-24 16:38:29 +01:00

32 lines
689 B
TypeScript

import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import { NativeModules, Platform } from 'react-native'
import en from './Locales/en.json'
import es from './Locales/es.json'
import ru from './Locales/ru.json'
const locale =
Platform.OS === 'ios'
? NativeModules.SettingsManager.settings.AppleLocale
: NativeModules.I18nManager.localeIdentifier
i18n.locale = locale
i18n.use(initReactI18next).init({
compatibilityJSON: 'v3',
fallbackLng: 'en',
resources: {
en,
es,
ru,
},
lng: locale.substring(0, 2),
ns: ['common'],
defaultNS: 'common',
debug: true,
interpolation: {
escapeValue: false,
},
})
export default i18n