feat: i18n user interface (#40306)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
32
client/i18n/config.js
Normal file
32
client/i18n/config.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import i18n from 'i18next';
|
||||
import { initReactI18next } from 'react-i18next';
|
||||
|
||||
const { environment, clientLocale } = require('../config/env');
|
||||
const { i18nextCodes } = require('./allLangs');
|
||||
|
||||
const i18nextCode = i18nextCodes[clientLocale];
|
||||
|
||||
i18n.use(initReactI18next).init({
|
||||
fallbackLng: i18nextCode,
|
||||
lng: i18nextCode,
|
||||
// we only load one language since each language will have it's own server
|
||||
resources: {
|
||||
[i18nextCode]: {
|
||||
translations: require(`./locales/${clientLocale}/translations.json`)
|
||||
}
|
||||
},
|
||||
ns: ['translations'],
|
||||
defaultNS: 'translations',
|
||||
returnObjects: true,
|
||||
debug: environment === 'development',
|
||||
interpolation: {
|
||||
escapeValue: false
|
||||
},
|
||||
react: {
|
||||
wait: true
|
||||
}
|
||||
});
|
||||
|
||||
i18n.languages = clientLocale;
|
||||
|
||||
export default i18n;
|
Reference in New Issue
Block a user