Add i18 support

This commit is contained in:
Urtzi Alfaro
2025-09-22 11:04:03 +02:00
parent ecfc6a1997
commit ee36c45d25
28 changed files with 2307 additions and 565 deletions

View File

@@ -7,6 +7,19 @@ 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';
// English translations
import commonEn from './en/common.json';
import recipesEn from './en/recipes.json';
import dashboardEn from './en/dashboard.json';
import productionEn from './en/production.json';
// Basque translations
import commonEu from './eu/common.json';
import dashboardEu from './eu/dashboard.json';
import productionEu from './eu/production.json';
// Translation resources by language
export const resources = {
@@ -19,11 +32,24 @@ export const resources = {
orders: ordersEs,
recipes: recipesEs,
errors: errorsEs,
dashboard: dashboardEs,
production: productionEs,
},
en: {
common: commonEn,
recipes: recipesEn,
dashboard: dashboardEn,
production: productionEn,
},
eu: {
common: commonEu,
dashboard: dashboardEu,
production: productionEu,
},
};
// Supported languages
export const supportedLanguages = ['es'] as const;
export const supportedLanguages = ['es', 'en', 'eu'] as const;
export type SupportedLanguage = typeof supportedLanguages[number];
// Default language
@@ -38,10 +64,24 @@ export const languageConfig = {
flag: '🇪🇸',
rtl: false,
},
en: {
name: 'English',
nativeName: 'English',
code: 'en',
flag: '🇺🇸',
rtl: false,
},
eu: {
name: 'Euskera',
nativeName: 'Euskera',
code: 'eu',
flag: '🏴󠁥󠁳󠁰󠁶󠁿',
rtl: false,
},
};
// Namespaces available in translations
export const namespaces = ['common', 'auth', 'inventory', 'foodSafety', 'suppliers', 'orders', 'recipes', 'errors'] as const;
export const namespaces = ['common', 'auth', 'inventory', 'foodSafety', 'suppliers', 'orders', 'recipes', 'errors', 'dashboard', 'production'] as const;
export type Namespace = typeof namespaces[number];
// Helper function to get language display name