Skip to content

Instantly share code, notes, and snippets.

@tariqulislam
Created February 16, 2020 09:27
Show Gist options
  • Select an option

  • Save tariqulislam/00fe15d81765c5a4901217b41d958b8d to your computer and use it in GitHub Desktop.

Select an option

Save tariqulislam/00fe15d81765c5a4901217b41d958b8d to your computer and use it in GitHub Desktop.
import i18n from 'i18next'
import LanguageDetector from "i18next-browser-languagedetector"
import {initReactI18next} from 'react-i18next'
import XHR from 'i18next-xhr-backend'
import languageEN from './locate/en/translate.json'
import languageJP from './locate/jp/translate.json'
i18n
.use(XHR)
.use(LanguageDetector)
.use(initReactI18next)
.init({
resources: {
en: languageEN,
jp: languageJP
},
/* default language when load the website in browser */
lng: "en",
/* When react i18next not finding any language to as default in borwser */
fallbackLng: "en",
/* debugger For Development environment */
debug: true,
ns: ["translations"],
defaultNS: "translations",
keySeparator: ".",
interpolation: {
escapeValue: false,
formatSeparator: ","
},
react: {
wait: true,
bindI18n: 'languageChanged loaded',
bindStore: 'added removed',
nsMode: 'default'
}
})
export default i18n;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment