Files
freeCodeCamp/client/i18n/config.js
Mrugesh Mohapatra b5f4754e2a fix: re-revert the API decoupling (#41263)
* fix(api): decouple api from curriculum

This reverts commit 8f0e441644 and
introduces the implementations from #40703.

* fix(gitpod): add curriculum build to GitPod

This reverts commit 706d70f58d and
introduces implementations from #41234.

* docs: update DevOps manual for api change (#41259)

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
2021-02-25 12:02:35 -08:00

43 lines
1.3 KiB
JavaScript

import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
const { clientLocale } = require('../../config/env.json');
const { i18nextCodes } = require('../../config/i18n/all-langs');
const i18nextCode = i18nextCodes[clientLocale];
i18n.use(initReactI18next).init({
fallbackLng: 'en',
lng: i18nextCode,
// we only load one language since each language will have it's own server
resources: {
[i18nextCode]: {
translations: require(`./locales/${clientLocale}/translations.json`),
trending: require(`./locales/${clientLocale}/trending.json`),
intro: require(`./locales/${clientLocale}/intro.json`),
metaTags: require(`./locales/${clientLocale}/meta-tags.json`)
},
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')
}
},
ns: ['translations', 'trending', 'intro', 'metaTags'],
defaultNS: 'translations',
returnObjects: true,
// Uncomment the next line for debug logging
// debug: true,
interpolation: {
escapeValue: false
},
react: {
wait: true
}
});
i18n.languages = clientLocale;
export default i18n;