2020-12-16 02:02:52 -06:00
|
|
|
import i18n from 'i18next';
|
|
|
|
import { initReactI18next } from 'react-i18next';
|
|
|
|
|
2021-02-22 07:53:59 +01:00
|
|
|
const { clientLocale } = require('../../config/env.json');
|
|
|
|
const { i18nextCodes } = require('../../config/i18n/all-langs');
|
2020-12-16 02:02:52 -06:00
|
|
|
|
|
|
|
const i18nextCode = i18nextCodes[clientLocale];
|
|
|
|
|
|
|
|
i18n.use(initReactI18next).init({
|
2021-02-24 13:20:42 -08:00
|
|
|
fallbackLng: 'en',
|
2020-12-16 02:02:52 -06:00
|
|
|
lng: i18nextCode,
|
|
|
|
// we only load one language since each language will have it's own server
|
|
|
|
resources: {
|
|
|
|
[i18nextCode]: {
|
2020-12-29 00:36:39 -08:00
|
|
|
translations: require(`./locales/${clientLocale}/translations.json`),
|
2021-01-13 07:09:45 -06:00
|
|
|
trending: require(`./locales/${clientLocale}/trending.json`),
|
2021-02-03 00:03:52 -08:00
|
|
|
intro: require(`./locales/${clientLocale}/intro.json`),
|
|
|
|
metaTags: require(`./locales/${clientLocale}/meta-tags.json`)
|
2021-02-24 13:20:42 -08:00
|
|
|
},
|
|
|
|
en: {
|
|
|
|
translations: require('./locales/english/translations.json'),
|
|
|
|
trending: require('./locales/english/trending.json'),
|
|
|
|
intro: require('./locales/english/intro.json'),
|
|
|
|
metaTags: require('./locales/english/meta-tags.json')
|
2020-12-16 02:02:52 -06:00
|
|
|
}
|
|
|
|
},
|
2021-02-03 00:03:52 -08:00
|
|
|
ns: ['translations', 'trending', 'intro', 'metaTags'],
|
2020-12-16 02:02:52 -06:00
|
|
|
defaultNS: 'translations',
|
|
|
|
returnObjects: true,
|
2021-01-28 13:52:39 +05:30
|
|
|
// Uncomment the next line for debug logging
|
|
|
|
// debug: true,
|
2020-12-16 02:02:52 -06:00
|
|
|
interpolation: {
|
|
|
|
escapeValue: false
|
|
|
|
},
|
|
|
|
react: {
|
|
|
|
wait: true
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
i18n.languages = clientLocale;
|
|
|
|
|
|
|
|
export default i18n;
|