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
pull/41253/head
Nicholas Carrigan (he/him) 2021-02-24 13:20:42 -08:00 committed by GitHub
parent c6d8996f39
commit 454b267138
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -7,7 +7,7 @@ const { i18nextCodes } = require('../../config/i18n/all-langs');
const i18nextCode = i18nextCodes[clientLocale];
i18n.use(initReactI18next).init({
fallbackLng: i18nextCode,
fallbackLng: 'en',
lng: i18nextCode,
// we only load one language since each language will have it's own server
resources: {
@ -16,6 +16,12 @@ i18n.use(initReactI18next).init({
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'],