Skip to content

Instantly share code, notes, and snippets.

@KennedyIhe

KennedyIhe/i18n.js Secret

Created Apr 28, 2020
Embed
What would you like to do?
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import Backend from 'i18next-xhr-backend';
i18n
.use(Backend)
.use(initReactI18next)
.init({
debug: true,
lng: 'en',
fallbackLng: 'en',
whitelist: ['en', 'es'],
interpolation: {
escapeValue: false,
},
backend: {
loadPath: 'src/translations/{{lng}}.json',
},
});
export default i18n;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment