-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathi18n.js
More file actions
35 lines (30 loc) · 746 Bytes
/
i18n.js
File metadata and controls
35 lines (30 loc) · 746 Bytes
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
import i18n from 'i18next'
import Backend from 'i18next-http-backend'
import LanguageDetector from 'i18next-browser-languagedetector'
import {initReactI18next} from 'react-i18next'
import localesEN from './locales/common.en.json';
import localesRU from './locales/common.ru.json';
const resources = {
en: {
translation: localesEN
},
ru: {
translation: localesRU
}
};
let i18nInstance;
if (!i18nInstance) {
i18nInstance = i18n
.createInstance()
.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
.init({
resources,
debug: true,
fallbackLng: 'en',
supportedLngs: [ 'en', 'ru', 'en-US', 'ru-RU' ],
initImmediate: false
})
}
export default i18nInstance;