frontend/src/i18n/index.ts (19 lines of code) (raw):
import i18n from 'i18next'
import {initReactI18next} from 'react-i18next'
import enStrings from '../../locales/en/strings.json'
const resources = {
en: {
translation: enStrings,
},
}
i18n.use(initReactI18next).init({
resources,
lng: 'en', // language to use, more information here: https://www.i18next.com/overview/configuration-options#languages-namespaces-resources
// you can use the i18n.changeLanguage function to change the language manually: https://www.i18next.com/overview/api#changelanguage
// if you're using a language detector, do not define the lng option
interpolation: {
escapeValue: false, // react already safes from xss
},
react: {
transKeepBasicHtmlNodesFor: ['br', 'strong', 'i', 'code', 'p'],
},
})
export default i18n