diff options
Diffstat (limited to 'client/src/i18nextInit.js')
-rw-r--r-- | client/src/i18nextInit.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/client/src/i18nextInit.js b/client/src/i18nextInit.js new file mode 100644 index 0000000..3ae0848 --- /dev/null +++ b/client/src/i18nextInit.js @@ -0,0 +1,41 @@ +import i18n from 'i18next' +import { initReactI18next } from 'react-i18next' +import Backend from 'i18next-xhr-backend' +import LanguageDetector from 'i18next-browser-languagedetector' +import translationEN from '../src/components/LanguageSelect/locales/en/translation.json' +import translationHI from '../src/components/LanguageSelect/locales/hi/translation.json' + +const fallbackLng = ['en'] +const availableLanguages = ['en', 'hi'] + +const resources = { + en: { + translation: translationEN + }, + hi: { + translation: translationHI + } +} + +i18n + .use(Backend) + .use(LanguageDetector) + .use(initReactI18next) + .init({ + resources, + fallbackLng, + + detection: { + checkWhitelist: true + }, + + debug: false, + + whitelist: availableLanguages, + + interpolation: { + escapeValue: false + } + }) + +export default i18n |