53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
|
|
// Spanish translations
|
||
|
|
import commonEs from './es/common.json';
|
||
|
|
import authEs from './es/auth.json';
|
||
|
|
import inventoryEs from './es/inventory.json';
|
||
|
|
import errorsEs from './es/errors.json';
|
||
|
|
|
||
|
|
// Translation resources by language
|
||
|
|
export const resources = {
|
||
|
|
es: {
|
||
|
|
common: commonEs,
|
||
|
|
auth: authEs,
|
||
|
|
inventory: inventoryEs,
|
||
|
|
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', '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, errorsEs };
|
||
|
|
|
||
|
|
// Default export with all translations
|
||
|
|
export default resources;
|