2023-09-22 09:33:13 +00:00
|
|
|
import i18n from 'i18next';
|
|
|
|
import { initReactI18next } from 'react-i18next';
|
|
|
|
|
|
|
|
import deJSON from './dictionaries/de.json';
|
|
|
|
import enJSON from './dictionaries/en.json';
|
|
|
|
|
2023-09-29 11:18:55 +00:00
|
|
|
// define translations
|
2023-09-22 09:33:13 +00:00
|
|
|
const resources = {
|
|
|
|
en: {
|
|
|
|
translation: enJSON,
|
|
|
|
},
|
|
|
|
de: {
|
|
|
|
translation: deJSON,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2023-09-29 11:18:55 +00:00
|
|
|
// initialize i18n with given locale
|
2023-09-22 09:33:13 +00:00
|
|
|
const initI18n = (locale) =>
|
2023-09-29 11:18:55 +00:00
|
|
|
i18n.use(initReactI18next).init({
|
|
|
|
resources,
|
|
|
|
lng: locale,
|
|
|
|
interpolation: {
|
|
|
|
escapeValue: false,
|
|
|
|
},
|
|
|
|
});
|
2023-09-22 09:33:13 +00:00
|
|
|
|
|
|
|
export default initI18n;
|