Add English language support with i18n implementation

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
This commit is contained in:
Claude
2026-02-06 17:46:01 +00:00
parent 9457d3d02f
commit f719d181c0
15 changed files with 768 additions and 58 deletions

207
frontend/locales/en.json Normal file
View File

@@ -0,0 +1,207 @@
{
"common": {
"or": "OR",
"loading": "Loading...",
"error": "Error",
"success": "Success",
"cancel": "Cancel",
"confirm": "Confirm",
"close": "Close",
"save": "Save",
"delete": "Delete",
"edit": "Edit",
"view": "View",
"back": "Back",
"next": "Next",
"previous": "Previous",
"search": "Search",
"filter": "Filter",
"export": "Export",
"import": "Import"
},
"auth": {
"login": "Log in",
"logout": "Log out",
"loginTitle": "Log in to access the analysis",
"username": "Username",
"password": "Password",
"enterButton": "Enter",
"enteringButton": "Logging in…",
"sessionInfo": "The session will remain active for 1 hour.",
"sessionExpired": "Session expired or incorrect credentials. Please log in again.",
"loginRequired": "You must log in to analyze data.",
"credentialsRequired": "Enter username and password",
"sessionStarted": "Session started"
},
"upload": {
"title": "Upload Your Data and Run Analysis",
"uploadFile": "Upload File",
"clickToUpload": "Click to upload a file",
"dragAndDrop": "or drag and drop here",
"fileTypes": "CSV, XLSX, or XLS",
"googleSheetPlaceholder": "Paste your Google Sheet URL here",
"invalidFileType": "Invalid file type. Upload a CSV or Excel file.",
"pleaseUploadFile": "Please upload a file or enter a Google Sheet URL.",
"generateSyntheticData": "Generate Synthetic Data",
"syntheticDataGenerated": "Synthetic Data Generated!",
"dataReceived": "Data Received!",
"noDataPrompt": "Don't have data on hand? Generate a sample dataset.",
"processingData": "Processing...",
"analyzingData": "Analyzing...",
"generating": "Generating...",
"readyToAnalyze": "Ready to analyze!",
"dataProcessed": "Data Processed",
"recordsAnalyzed": "Records analyzed",
"monthsHistory": "Months of history",
"sourceSystem": "Source system",
"highConfidence": "Confidence: High",
"mediumConfidence": "Confidence: Medium",
"lowConfidence": "Confidence: Low",
"subtitle": "Use one of the following options to send us your data for analysis."
},
"stepper": {
"step1": "Step 1",
"step2": "Step 2",
"step3": "Step 3",
"selectTier": "Select Tier",
"uploadData": "Upload Data",
"viewResults": "View Results"
},
"tiers": {
"gold": {
"name": "GOLD Analysis",
"description": "5 complete dimensions with advanced Agentic Readiness",
"features": [
"5 dimensions: Volumetry, Efficiency, Effectiveness, Complexity, Agentic Readiness",
"Generative AI: Personalized insights by OpenAI",
"Transformation roadmap: AUTOMATE, ASSIST, AUGMENT phases",
"Prioritization matrix with maturity levels",
"Advanced benchmarking against industry",
"Exportable PDF reports"
]
},
"silver": {
"name": "SILVER Analysis",
"description": "4 core dimensions with operational metrics",
"features": [
"4 dimensions: Volumetry, Efficiency, Effectiveness, Economy",
"Analysis without generative AI",
"Simplified roadmap",
"Basic benchmark",
"Opportunity matrix"
]
},
"express": {
"name": "EXPRESS Analysis",
"description": "Quick diagnosis of volumetry and efficiency",
"features": [
"2 dimensions: Volumetry, Efficiency",
"Instant analysis",
"No AI or roadmap",
"Ideal for quick tests"
]
}
},
"dashboard": {
"title": "Diagnostic Dashboard",
"viewDashboard": "View Diagnostic Dashboard",
"generateAnalysis": "Generate Analysis",
"analyzing": "Analyzing...",
"analysisComplete": "Analysis completed!",
"dataLoadedFromCache": "Data loaded from cache!",
"reloadPage": "Reload Page"
},
"tabs": {
"executive": "Summary",
"dimensions": "Dimensions",
"agenticReadiness": "Agentic Readiness",
"roadmap": "Roadmap",
"law10": "Law 10/2025"
},
"dimensions": {
"volumetry": "Volumetry & Distribution",
"operationalPerformance": "Operational Efficiency",
"effectiveness": "Effectiveness & Resolution",
"complexity": "Complexity & Predictability",
"economy": "Economy & Costs",
"agenticReadiness": "Agentic Readiness"
},
"healthStatus": {
"excellent": "EXCELLENT",
"excellentDesc": "Top quartile, role model",
"good": "GOOD",
"goodDesc": "Above benchmarks, solid performance",
"medium": "MEDIUM",
"mediumDesc": "Within expected range",
"low": "LOW",
"lowDesc": "Needs improvement, below benchmarks",
"critical": "CRITICAL",
"criticalDesc": "Requires immediate intervention"
},
"benchmark": {
"title": "Industry Benchmark (P50)",
"aboveBenchmark": "Above benchmarks, solid performance",
"belowBenchmark": "Needs improvement, below benchmarks",
"withinRange": "Within expected range"
},
"roadmap": {
"wave1": "Wave 1: AUTOMATE",
"wave2": "Wave 2: ASSIST",
"wave3": "Wave 3: AUGMENT",
"quickWins": "Quick Wins (0-6 months)",
"buildCapability": "Build Capability (6-12 months)",
"transform": "Transform (12-18 months)",
"automate": "Automate",
"duration3to6": "3-6 months",
"duration6to12": "6-12 months",
"duration12to18": "12-18 months"
},
"opportunities": {
"viewCriticalActions": "View Critical Actions",
"exploreImprovements": "Explore Improvements",
"inGoodState": "In good state",
"prioritize": "Prioritize",
"optimize": "Optimize",
"maintain": "Maintain"
},
"agenticReadiness": {
"score": "Agentic Readiness Score",
"confidence": "Confidence",
"readyForCopilot": "Ready for Copilot",
"readyForCopilotDesc": "Processes with sufficient predictability and simplicity for AI assistance (real-time suggestions, autocomplete).",
"optimizeFirst": "Optimize first",
"optimizeFirstDesc": "Standardize processes and reduce variability before implementing AI assistance.",
"requiresHumanManagement": "Requires human management",
"requiresHumanManagementDesc": "Complex or variable processes that need human intervention before considering automation."
},
"economicModel": {
"title": "Economic Model",
"costPerInteraction": "Cost per interaction (CPI) by channel",
"totalCost": "Total Cost",
"avgCost": "Average Cost",
"costBreakdown": "Cost Breakdown",
"enterCostPerHour": "Please enter the cost per hour for the agent.",
"noCostConfig": "No cost configuration"
},
"charts": {
"volumeByDayAndHour": "Volume by day of week and hour",
"ahtDistributionBySkill": "AHT distribution by skill",
"resolutionFunnelBySkill": "Resolution funnel (P50) by skill",
"csatDistribution": "CSAT distribution"
},
"errors": {
"renderError": "Rendering Error",
"componentError": "This component encountered an error and could not render correctly.",
"viewTechnicalDetails": "View technical details",
"errorInComponent": "Error in {{componentName}}",
"somethingWentWrong": "Something went wrong",
"tryAgain": "Try again"
},
"methodology": {
"title": "Methodology",
"description": "Learn how we calculate metrics",
"close": "Close",
"appliedBadge": "Data Transformation Methodology Applied",
"appliedBadgeShort": "Methodology"
}
}