import i18n from 'i18next'; import * as Localization from 'expo-localization'; import { initReactI18next } from 'react-i18next'; import en from './locales/en.json'; import zh from './locales/zh-CN.json'; import th from './locales/th.json'; const resources = { zh: { translation: zh, }, en: { translation: en, }, th: { translation: th, }, }; i18n .use(initReactI18next) // passes i18n down to react-i18next .init({ resources, lng: Localization.locale, fallbackLng: 'zh-CN', // use en if detected lng is not available keySeparator: false, // we do not use keys in form messages.welcome interpolation: { escapeValue: false, // react already safes from xss }, }); export default i18n;