Public Access
23 lines
698 B
JavaScript
23 lines
698 B
JavaScript
import i18n from 'i18next';
|
|
import {initReactI18next} from 'react-i18next';
|
|
import HttpBackend from 'i18next-http-backend';
|
|
import {cacheLanguage, readCachedLanguage} from './utils/settings.js';
|
|
|
|
|
|
i18n.use(HttpBackend)
|
|
.use(initReactI18next)
|
|
.init({
|
|
lng: readCachedLanguage() ?? 'de',
|
|
fallbackLng: 'en',
|
|
backend: {
|
|
// A browser kept an old file without its Cache-Control and showed raw keys; a new URL per version avoids that.
|
|
loadPath: `/i18n/{{lng}}.json?v=${__TRANSLATIONS_VERSION__}`,
|
|
},
|
|
interpolation: {
|
|
escapeValue: false
|
|
}
|
|
});
|
|
|
|
i18n.on('languageChanged', cacheLanguage);
|
|
|
|
export default i18n; |