feat: Add i18n support for AI insights with structured reasoning
Complete i18n implementation for internal service reasoning: - Update AIInsight interface to include reasoning_data field - Integrate useReasoningTranslation hook in AI Insights page - Add translation keys for safety stock, price forecaster, and optimization Translation coverage (EN/ES/EU): - Safety Stock: statistical z-score, advanced variability, fixed percentage, errors - Price Forecaster: price change predictions, volatility alerts, buying recommendations - Optimization: EOQ calculations, MOQ/max constraints, tier pricing Benefits: - AI insights now display in user's preferred language - Consistent with PO/Batch reasoning translation pattern - Structured parameters enable rich, contextualized translations - Falls back gracefully to description field if translation missing Implementation: - frontend/src/api/services/aiInsights.ts: Add reasoning_data to interface - frontend/src/pages/app/analytics/ai-insights/AIInsightsPage.tsx: Translate insights - frontend/src/locales/*/reasoning.json: Add safetyStock, priceForecaster, optimization keys This completes the full i18n implementation for the bakery AI system.
This commit is contained in:
@@ -44,6 +44,29 @@
|
||||
"LEAD_TIME_INVALID": "Lead time or demand deviation is zero or negative",
|
||||
"NO_DEMAND_DATA": "No historical demand data available (minimum 2 data points required)"
|
||||
},
|
||||
"safetyStock": {
|
||||
"statistical_z_score": "Safety stock calculated using statistical method (service level {{service_level}}%, z-score {{z_score}}). Based on demand std dev {{demand_std_dev}} and {{lead_time_days}}-day lead time. Result: {{safety_stock}} units.",
|
||||
"advanced_variability": "Safety stock calculated with advanced variability analysis. Accounts for both demand variability (σ={{demand_std_dev}}) and lead time uncertainty (σ={{lead_time_std_dev}} days). Result: {{safety_stock}} units.",
|
||||
"fixed_percentage": "Safety stock set at {{percentage}}% of {{lead_time_days}}-day demand ({{lead_time_demand}} units). Result: {{safety_stock}} units.",
|
||||
"error_lead_time_invalid": "Cannot calculate safety stock: lead time ({{lead_time_days}} days) or demand std dev ({{demand_std_dev}}) is invalid.",
|
||||
"error_insufficient_data": "Insufficient demand history for safety stock calculation ({{data_points}} data points, need {{min_required}})."
|
||||
},
|
||||
"priceForecaster": {
|
||||
"decrease_expected": "Price expected to decrease {{change_pct}}% over next {{forecast_days}} days. Current: €{{current_price}}, forecast: €{{forecast_mean}}. Recommendation: Wait for better price.",
|
||||
"increase_expected": "Price expected to increase {{change_pct}}% over next {{forecast_days}} days. Current: €{{current_price}}, forecast: €{{forecast_mean}}. Recommendation: Buy now to lock in current price.",
|
||||
"high_volatility": "High price volatility detected (CV={{coefficient}}). Average daily price change: {{avg_daily_change_pct}}%. Recommendation: Wait for price dip.",
|
||||
"below_average": "Current price €{{current_price}} is {{below_avg_pct}}% below historical average (€{{mean_price}}). Favorable buying opportunity.",
|
||||
"stable": "Price is stable. Current: €{{current_price}}, forecast: €{{forecast_mean}} ({{expected_change_pct}}% change expected). Normal procurement timing recommended.",
|
||||
"insufficient_data": "Insufficient price history for reliable forecast ({{history_days}} days available, need {{min_required_days}} days)."
|
||||
},
|
||||
"optimization": {
|
||||
"eoq_base": "Economic Order Quantity calculated: {{eoq}} units (required: {{required_quantity}}, annual demand: {{annual_demand}}). Optimized for {{optimal_quantity}} units.",
|
||||
"moq_applied": "Minimum order quantity constraint applied: {{moq}} units.",
|
||||
"max_applied": "Maximum order quantity constraint applied: {{max_qty}} units.",
|
||||
"no_tiers": "No price tiers available for this product. Base quantity: {{base_quantity}} units at €{{unit_price}} per unit.",
|
||||
"current_tier": "Current pricing tier: €{{current_tier_price}} per unit for {{base_quantity}} units (total: €{{base_cost}}).",
|
||||
"tier_upgraded": "Upgraded to better price tier! Ordering {{tier_min_qty}} units ({{additional_qty}} extra) at €{{tier_price}} per unit saves €{{savings}} compared to {{base_quantity}} units at €{{base_price}}."
|
||||
},
|
||||
"jtbd": {
|
||||
"health_status": {
|
||||
"green": "Everything is running smoothly",
|
||||
|
||||
Reference in New Issue
Block a user