geosphere-maps/app/[locale]/i18n.js
2023-09-22 11:33:13 +02:00

29 lines
564 B
JavaScript

import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import deJSON from './dictionaries/de.json';
import enJSON from './dictionaries/en.json';
// the translations
const resources = {
en: {
translation: enJSON,
},
de: {
translation: deJSON,
},
};
const initI18n = (locale) =>
i18n
.use(initReactI18next) // passes i18n down to react-i18next
.init({
resources,
lng: locale,
interpolation: {
escapeValue: false, // react already safes from xss
},
});
export default initI18n;