33651/frontend/src/i18n.ts
copilot-swe-agent[bot] 4ad8da4083 Fix JSON parsing error in i18n configuration and API error handling
Co-authored-by: lora322 <39804183+lora322@users.noreply.github.com>
2025-09-24 02:49:40 +00:00

24 lines
600 B
TypeScript

import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import HttpApi from 'i18next-http-backend';
import LanguageDetector from 'i18next-browser-languagedetector';
i18n
.use(HttpApi)
.use(LanguageDetector)
.use(initReactI18next)
.init({
fallbackLng: 'en',
defaultNS: 'common',
ns: ['common'],
detection: {
order: ['localStorage', 'navigator'],
lookupLocalStorage: 'app_lang_33651',
caches: ['localStorage'],
},
backend: {
loadPath: '/locales/{{lng}}/{{ns}}.json',
},
interpolation: { escapeValue: false },
});