github.com/martinohmann/rfoutlet@v1.2.1-0.20220707195255-8a66aa411105/web/src/i18n.js (about) 1 import i18n from 'i18next'; 2 import { initReactI18next } from 'react-i18next'; 3 import LanguageDetector from 'i18next-browser-languagedetector'; 4 5 import translations_de_DE from './translations/de-DE.json'; 6 import translations_en_US from './translations/en-US.json'; 7 8 export const fallbackLanguage = 'en-US'; 9 10 export const languages = { 11 'de-DE': { 12 displayName: 'Deutsch', 13 translation: translations_de_DE, 14 }, 15 'en-US': { 16 displayName: 'English', 17 translation: translations_en_US, 18 }, 19 } 20 21 const i18nConfig = { 22 resources: languages, 23 fallbackLng: fallbackLanguage, 24 debug: true, 25 interpolation: { 26 escapeValue: false, 27 }, 28 } 29 30 i18n 31 .use(LanguageDetector) 32 .use(initReactI18next) 33 .init(i18nConfig); 34 35 export default i18n;