Files
bakery-ia/frontend/src/locales/index.ts
2025-10-17 18:14:28 +02:00

139 lines
4.4 KiB
TypeScript

// Spanish translations
import commonEs from './es/common.json';
import authEs from './es/auth.json';
import inventoryEs from './es/inventory.json';
import foodSafetyEs from './es/foodSafety.json';
import suppliersEs from './es/suppliers.json';
import ordersEs from './es/orders.json';
import recipesEs from './es/recipes.json';
import errorsEs from './es/errors.json';
import dashboardEs from './es/dashboard.json';
import productionEs from './es/production.json';
import equipmentEs from './es/equipment.json';
import landingEs from './es/landing.json';
// English translations
import commonEn from './en/common.json';
import authEn from './en/auth.json';
import inventoryEn from './en/inventory.json';
import foodSafetyEn from './en/foodSafety.json';
import suppliersEn from './en/suppliers.json';
import ordersEn from './en/orders.json';
import recipesEn from './en/recipes.json';
import errorsEn from './en/errors.json';
import dashboardEn from './en/dashboard.json';
import productionEn from './en/production.json';
import equipmentEn from './en/equipment.json';
import landingEn from './en/landing.json';
// Basque translations
import commonEu from './eu/common.json';
import authEu from './eu/auth.json';
import inventoryEu from './eu/inventory.json';
import foodSafetyEu from './eu/foodSafety.json';
import suppliersEu from './eu/suppliers.json';
import ordersEu from './eu/orders.json';
import recipesEu from './eu/recipes.json';
import errorsEu from './eu/errors.json';
import dashboardEu from './eu/dashboard.json';
import productionEu from './eu/production.json';
import equipmentEu from './eu/equipment.json';
import landingEu from './eu/landing.json';
// Translation resources by language
export const resources = {
es: {
common: commonEs,
auth: authEs,
inventory: inventoryEs,
foodSafety: foodSafetyEs,
suppliers: suppliersEs,
orders: ordersEs,
recipes: recipesEs,
errors: errorsEs,
dashboard: dashboardEs,
production: productionEs,
equipment: equipmentEs,
landing: landingEs,
},
en: {
common: commonEn,
auth: authEn,
inventory: inventoryEn,
foodSafety: foodSafetyEn,
suppliers: suppliersEn,
orders: ordersEn,
recipes: recipesEn,
errors: errorsEn,
dashboard: dashboardEn,
production: productionEn,
equipment: equipmentEn,
landing: landingEn,
},
eu: {
common: commonEu,
auth: authEu,
inventory: inventoryEu,
foodSafety: foodSafetyEu,
suppliers: suppliersEu,
orders: ordersEu,
recipes: recipesEu,
errors: errorsEu,
dashboard: dashboardEu,
production: productionEu,
equipment: equipmentEu,
landing: landingEu,
},
};
// Supported languages
export const supportedLanguages = ['es', 'en', 'eu'] as const;
export type SupportedLanguage = typeof supportedLanguages[number];
// Default language
export const defaultLanguage: SupportedLanguage = 'es';
// Language configuration
export const languageConfig = {
es: {
name: 'Español',
nativeName: 'Español',
code: 'es',
flag: 'es', // Using language code instead of flag for proper language identification
rtl: false,
},
en: {
name: 'English',
nativeName: 'English',
code: 'en',
flag: 'en', // Using language code instead of flag for proper language identification
rtl: false,
},
eu: {
name: 'Basque',
nativeName: 'Euskera',
code: 'eu',
flag: 'eu', // Using language code instead of flag for proper language identification
rtl: false,
},
};
// Namespaces available in translations
export const namespaces = ['common', 'auth', 'inventory', 'foodSafety', 'suppliers', 'orders', 'recipes', 'errors', 'dashboard', 'production', 'equipment', 'landing'] as const;
export type Namespace = typeof namespaces[number];
// Helper function to get language display name
export const getLanguageDisplayName = (language: SupportedLanguage): string => {
return languageConfig[language]?.nativeName || language;
};
// Helper function to check if language is supported
export const isSupportedLanguage = (language: string): language is SupportedLanguage => {
return supportedLanguages.includes(language as SupportedLanguage);
};
// Export individual language modules for direct imports
export { commonEs, authEs, inventoryEs, foodSafetyEs, suppliersEs, ordersEs, recipesEs, errorsEs, equipmentEs, landingEs };
// Default export with all translations
export default resources;