57 lines
1.7 KiB
TypeScript
57 lines
1.7 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 errorsEs from './es/errors.json';
|
|
|
|
// Translation resources by language
|
|
export const resources = {
|
|
es: {
|
|
common: commonEs,
|
|
auth: authEs,
|
|
inventory: inventoryEs,
|
|
foodSafety: foodSafetyEs,
|
|
suppliers: suppliersEs,
|
|
errors: errorsEs,
|
|
},
|
|
};
|
|
|
|
// Supported languages
|
|
export const supportedLanguages = ['es'] 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: '🇪🇸',
|
|
rtl: false,
|
|
},
|
|
};
|
|
|
|
// Namespaces available in translations
|
|
export const namespaces = ['common', 'auth', 'inventory', 'foodSafety', 'suppliers', 'errors'] 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, errorsEs };
|
|
|
|
// Default export with all translations
|
|
export default resources; |