Implemented comprehensive internationalization (i18n) for both frontend and backend: Frontend: - Added react-i18next configuration with Spanish (default) and English - Created translation files (locales/es.json, locales/en.json) - Refactored core components to use i18n: LoginPage, DashboardHeader, DataUploader - Created LanguageSelector component with toggle between ES/EN - Updated API client to send Accept-Language header Backend: - Created i18n module with translation dictionary for error messages - Updated security.py to return localized authentication errors - Updated api/analysis.py to return localized validation errors - Implemented language detection from Accept-Language header Spanish remains the default language ensuring backward compatibility. Users can switch between languages using the language selector in the dashboard header. https://claude.ai/code/session_1N9VX
22 lines
559 B
TypeScript
22 lines
559 B
TypeScript
import i18n from 'i18next';
|
|
import { initReactI18next } from 'react-i18next';
|
|
import es from './locales/es.json';
|
|
import en from './locales/en.json';
|
|
|
|
// Configuración de i18next
|
|
i18n
|
|
.use(initReactI18next)
|
|
.init({
|
|
resources: {
|
|
es: { translation: es },
|
|
en: { translation: en },
|
|
},
|
|
lng: localStorage.getItem('language') || 'es', // Español por defecto
|
|
fallbackLng: 'es', // Si falla una traducción, usa español
|
|
interpolation: {
|
|
escapeValue: false, // React ya escapa por defecto
|
|
},
|
|
});
|
|
|
|
export default i18n;
|