mirror of
https://github.com/KoalaSat/nostros.git
synced 2024-09-30 15:10:43 +00:00
32 lines
689 B
TypeScript
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
|