feat: use en as i18n fallback (#41246)
* feat: use en as i18n fallback Loads the English versions of the files as a "fallback" language to avoid displaying keys when a translation is missing. * fix: use en as fallback key
This commit is contained in:
committed by
GitHub
parent
c6d8996f39
commit
454b267138
@ -7,7 +7,7 @@ const { i18nextCodes } = require('../../config/i18n/all-langs');
|
|||||||
const i18nextCode = i18nextCodes[clientLocale];
|
const i18nextCode = i18nextCodes[clientLocale];
|
||||||
|
|
||||||
i18n.use(initReactI18next).init({
|
i18n.use(initReactI18next).init({
|
||||||
fallbackLng: i18nextCode,
|
fallbackLng: 'en',
|
||||||
lng: i18nextCode,
|
lng: i18nextCode,
|
||||||
// we only load one language since each language will have it's own server
|
// we only load one language since each language will have it's own server
|
||||||
resources: {
|
resources: {
|
||||||
@ -16,6 +16,12 @@ i18n.use(initReactI18next).init({
|
|||||||
trending: require(`./locales/${clientLocale}/trending.json`),
|
trending: require(`./locales/${clientLocale}/trending.json`),
|
||||||
intro: require(`./locales/${clientLocale}/intro.json`),
|
intro: require(`./locales/${clientLocale}/intro.json`),
|
||||||
metaTags: require(`./locales/${clientLocale}/meta-tags.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'],
|
ns: ['translations', 'trending', 'intro', 'metaTags'],
|
||||||
|
Reference in New Issue
Block a user