summaryrefslogtreecommitdiff
path: root/client/src/i18nextInit.js
blob: 3ae08485aeadf32fb733761911127e635bbc5abf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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