Files
bakery-ia/REASONING_I18N_AUDIT.md

66 lines
2.4 KiB
Markdown
Raw Normal View History

# Reasoning i18n Audit Report
## Files with Hardcoded English Reasoning Text
### ✅ Already Fixed
1. **services/orchestrator/app/services/dashboard_service.py** - Now returns reasoning_data
2. **services/procurement/app/services/procurement_service.py** - Generates structured reasoning_data
3. **services/production/app/services/production_service.py** - Generates structured reasoning_data
### ❌ Needs Fixing
#### 1. Demo Seed Scripts
**File:** `services/procurement/scripts/demo/seed_demo_purchase_orders.py`
- Line 126: `"Low stock detected for {supplier.name} items..."`
- Line 127: `"Stock-out risk in {days_until_delivery + 2} days..."`
- Line 135: `"Auto-approved based on supplier trust score..."`
**File:** `services/production/scripts/demo/seed_demo_batches.py`
- Similar hardcoded text (needs check)
**Fix:** Use `create_po_reasoning_*()` helper functions
#### 2. Safety Stock Calculator
**File:** `services/procurement/app/services/safety_stock_calculator.py`
- Line 111: `'Lead time or demand std dev is zero or negative'`
- Line 163: `'Insufficient historical demand data (need at least 2 data points)'`
**Fix:** Return structured error codes instead of English text
#### 3. Replenishment Planning Service
**File:** `services/procurement/app/services/replenishment_planning_service.py`
- Line 376: `'Insufficient data for safety stock calculation'`
**Fix:** Return structured error codes
#### 4. ML Services
**File:** `services/procurement/app/ml/price_forecaster.py`
- Needs audit for hardcoded reasoning text
#### 5. Frontend Components
**File:** `frontend/src/components/dashboard/OrchestrationSummaryCard.tsx`
- Hardcoded English text: "Last Night I Planned Your Day", "All caught up!", etc.
**File:** `frontend/src/components/dashboard/HealthStatusCard.tsx`
- Hardcoded English text
**File:** `frontend/src/components/dashboard/ActionQueueCard.tsx`
- Hardcoded English text: "What Needs Your Attention", "Why this is needed:", etc.
**File:** `frontend/src/components/dashboard/ProductionTimelineCard.tsx`
- Hardcoded English text
**File:** `frontend/src/components/dashboard/InsightsGrid.tsx`
- Uses backend labels (good) but needs i18n setup
## Strategy
### Backend
- Return structured error codes: `{"type": "error", "code": "INSUFFICIENT_DATA", "params": {...}}`
- Frontend translates based on code
### Frontend
- Setup `react-i18next`
- Create translation files for EN, ES, CA
- Update all dashboard components to use `t()` function