fix: Add missing 'reasoning' namespace to i18n configuration
CRITICAL FIX: Translation keys showing instead of translated text
The Bug:
--------
Dashboard components were using useTranslation('reasoning') but the
'reasoning' namespace was NOT loaded into i18n configuration.
Result: i18n couldn't find translations and returned keys literally:
- "jtbd.health_status.last_updated" instead of "Last updated" / "Última actualización"
- "jtbd.action_queue.all_caught_up" instead of "All caught up!" / "¡Todo al día!"
- "jtbd.production_timeline.no_production" instead of translations
- etc.
Why It Happened:
----------------
locales/index.ts was missing:
1. Import statements for reasoning.json (all 3 languages)
2. 'reasoning' property in resources object (es/en/eu)
3. 'reasoning' in namespaces array
The Fix:
--------
Added to frontend/src/locales/index.ts:
1. Imports:
import reasoningEs from './es/reasoning.json';
import reasoningEn from './en/reasoning.json';
import reasoningEu from './eu/reasoning.json';
2. Resources object:
es: { ..., reasoning: reasoningEs }
en: { ..., reasoning: reasoningEn }
eu: { ..., reasoning: reasoningEu }
3. Namespaces array:
export const namespaces = [..., 'reasoning'] as const;
4. Exports:
export { ..., reasoningEs };
Now:
----
✅ t('jtbd.health_status.last_updated') returns "Last updated" (en) or "Última actualización" (es)
✅ All dashboard translations work in all 3 languages (es, en, eu)
✅ Language switching works properly
This commit is contained in:
@@ -13,6 +13,7 @@ import equipmentEs from './es/equipment.json';
|
|||||||
import landingEs from './es/landing.json';
|
import landingEs from './es/landing.json';
|
||||||
import settingsEs from './es/settings.json';
|
import settingsEs from './es/settings.json';
|
||||||
import ajustesEs from './es/ajustes.json';
|
import ajustesEs from './es/ajustes.json';
|
||||||
|
import reasoningEs from './es/reasoning.json';
|
||||||
|
|
||||||
// English translations
|
// English translations
|
||||||
import commonEn from './en/common.json';
|
import commonEn from './en/common.json';
|
||||||
@@ -29,6 +30,7 @@ import equipmentEn from './en/equipment.json';
|
|||||||
import landingEn from './en/landing.json';
|
import landingEn from './en/landing.json';
|
||||||
import settingsEn from './en/settings.json';
|
import settingsEn from './en/settings.json';
|
||||||
import ajustesEn from './en/ajustes.json';
|
import ajustesEn from './en/ajustes.json';
|
||||||
|
import reasoningEn from './en/reasoning.json';
|
||||||
|
|
||||||
// Basque translations
|
// Basque translations
|
||||||
import commonEu from './eu/common.json';
|
import commonEu from './eu/common.json';
|
||||||
@@ -45,6 +47,7 @@ import equipmentEu from './eu/equipment.json';
|
|||||||
import landingEu from './eu/landing.json';
|
import landingEu from './eu/landing.json';
|
||||||
import settingsEu from './eu/settings.json';
|
import settingsEu from './eu/settings.json';
|
||||||
import ajustesEu from './eu/ajustes.json';
|
import ajustesEu from './eu/ajustes.json';
|
||||||
|
import reasoningEu from './eu/reasoning.json';
|
||||||
|
|
||||||
// Translation resources by language
|
// Translation resources by language
|
||||||
export const resources = {
|
export const resources = {
|
||||||
@@ -63,6 +66,7 @@ export const resources = {
|
|||||||
landing: landingEs,
|
landing: landingEs,
|
||||||
settings: settingsEs,
|
settings: settingsEs,
|
||||||
ajustes: ajustesEs,
|
ajustes: ajustesEs,
|
||||||
|
reasoning: reasoningEs,
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
common: commonEn,
|
common: commonEn,
|
||||||
@@ -79,6 +83,7 @@ export const resources = {
|
|||||||
landing: landingEn,
|
landing: landingEn,
|
||||||
settings: settingsEn,
|
settings: settingsEn,
|
||||||
ajustes: ajustesEn,
|
ajustes: ajustesEn,
|
||||||
|
reasoning: reasoningEn,
|
||||||
},
|
},
|
||||||
eu: {
|
eu: {
|
||||||
common: commonEu,
|
common: commonEu,
|
||||||
@@ -95,6 +100,7 @@ export const resources = {
|
|||||||
landing: landingEu,
|
landing: landingEu,
|
||||||
settings: settingsEu,
|
settings: settingsEu,
|
||||||
ajustes: ajustesEu,
|
ajustes: ajustesEu,
|
||||||
|
reasoning: reasoningEu,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -131,7 +137,7 @@ export const languageConfig = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Namespaces available in translations
|
// Namespaces available in translations
|
||||||
export const namespaces = ['common', 'auth', 'inventory', 'foodSafety', 'suppliers', 'orders', 'recipes', 'errors', 'dashboard', 'production', 'equipment', 'landing', 'settings', 'ajustes'] as const;
|
export const namespaces = ['common', 'auth', 'inventory', 'foodSafety', 'suppliers', 'orders', 'recipes', 'errors', 'dashboard', 'production', 'equipment', 'landing', 'settings', 'ajustes', 'reasoning'] as const;
|
||||||
export type Namespace = typeof namespaces[number];
|
export type Namespace = typeof namespaces[number];
|
||||||
|
|
||||||
// Helper function to get language display name
|
// Helper function to get language display name
|
||||||
@@ -145,7 +151,7 @@ export const isSupportedLanguage = (language: string): language is SupportedLang
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Export individual language modules for direct imports
|
// Export individual language modules for direct imports
|
||||||
export { commonEs, authEs, inventoryEs, foodSafetyEs, suppliersEs, ordersEs, recipesEs, errorsEs, equipmentEs, landingEs, settingsEs, ajustesEs };
|
export { commonEs, authEs, inventoryEs, foodSafetyEs, suppliersEs, ordersEs, recipesEs, errorsEs, equipmentEs, landingEs, settingsEs, ajustesEs, reasoningEs };
|
||||||
|
|
||||||
// Default export with all translations
|
// Default export with all translations
|
||||||
export default resources;
|
export default resources;
|
||||||
|
|||||||
Reference in New Issue
Block a user