137 lines
3.4 KiB
TypeScript
137 lines
3.4 KiB
TypeScript
// src/i18n/index.ts
|
|
import i18n from 'i18next';
|
|
import { initReactI18next } from 'react-i18next';
|
|
import LanguageDetector from 'i18next-browser-languagedetector';
|
|
|
|
const resources = {
|
|
es: {
|
|
translation: {
|
|
// Common
|
|
"loading": "Cargando...",
|
|
"save": "Guardar",
|
|
"cancel": "Cancelar",
|
|
"delete": "Eliminar",
|
|
"edit": "Editar",
|
|
"close": "Cerrar",
|
|
"yes": "Sí",
|
|
"no": "No",
|
|
|
|
// Navigation
|
|
"dashboard": "Panel Principal",
|
|
"forecasts": "Predicciones",
|
|
"orders": "Pedidos",
|
|
"settings": "Configuración",
|
|
"logout": "Cerrar Sesión",
|
|
|
|
// Auth
|
|
"login": "Iniciar Sesión",
|
|
"register": "Registrarse",
|
|
"email": "Correo electrónico",
|
|
"password": "Contraseña",
|
|
"confirmPassword": "Confirmar contraseña",
|
|
"fullName": "Nombre completo",
|
|
"welcomeBack": "¡Bienvenido de vuelta!",
|
|
"createAccount": "Crear cuenta",
|
|
|
|
// Dashboard
|
|
"todaySales": "Ventas de Hoy",
|
|
"wasteReduction": "Reducción Desperdicio",
|
|
"aiAccuracy": "Precisión IA",
|
|
"stockouts": "Roturas Stock",
|
|
|
|
// Forecasts
|
|
"highConfidence": "Alta confianza",
|
|
"mediumConfidence": "Confianza media",
|
|
"lowConfidence": "Baja confianza",
|
|
"predictionsForToday": "Predicciones para Hoy",
|
|
"weatherImpact": "Impacto del clima",
|
|
|
|
// Orders
|
|
"newOrder": "Nuevo Pedido",
|
|
"pending": "Pendiente",
|
|
"confirmed": "Confirmado",
|
|
"delivered": "Entregado",
|
|
"cancelled": "Cancelado",
|
|
|
|
// Products
|
|
"croissants": "Croissants",
|
|
"bread": "Pan de molde",
|
|
"baguettes": "Baguettes",
|
|
"coffee": "Café",
|
|
"pastries": "Napolitanas",
|
|
"muffins": "Magdalenas",
|
|
"donuts": "Donuts",
|
|
"sandwiches": "Bocadillos"
|
|
}
|
|
},
|
|
en: {
|
|
translation: {
|
|
// Common
|
|
"loading": "Loading...",
|
|
"save": "Save",
|
|
"cancel": "Cancel",
|
|
"delete": "Delete",
|
|
"edit": "Edit",
|
|
"close": "Close",
|
|
"yes": "Yes",
|
|
"no": "No",
|
|
|
|
// Navigation
|
|
"dashboard": "Dashboard",
|
|
"forecasts": "Forecasts",
|
|
"orders": "Orders",
|
|
"settings": "Settings",
|
|
"logout": "Logout",
|
|
|
|
// Auth
|
|
"login": "Login",
|
|
"register": "Register",
|
|
"email": "Email",
|
|
"password": "Password",
|
|
"confirmPassword": "Confirm password",
|
|
"fullName": "Full name",
|
|
"welcomeBack": "Welcome back!",
|
|
"createAccount": "Create account",
|
|
|
|
// Dashboard
|
|
"todaySales": "Today's Sales",
|
|
"wasteReduction": "Waste Reduction",
|
|
"aiAccuracy": "AI Accuracy",
|
|
"stockouts": "Stockouts",
|
|
|
|
// Forecasts
|
|
"highConfidence": "High confidence",
|
|
"mediumConfidence": "Medium confidence",
|
|
"lowConfidence": "Low confidence",
|
|
"predictionsForToday": "Today's Predictions",
|
|
"weatherImpact": "Weather impact",
|
|
|
|
// Orders
|
|
"newOrder": "New Order",
|
|
"pending": "Pending",
|
|
"confirmed": "Confirmed",
|
|
"delivered": "Delivered",
|
|
"cancelled": "Cancelled"
|
|
}
|
|
}
|
|
};
|
|
|
|
i18n
|
|
.use(LanguageDetector)
|
|
.use(initReactI18next)
|
|
.init({
|
|
resources,
|
|
fallbackLng: 'es',
|
|
debug: process.env.NODE_ENV === 'development',
|
|
|
|
interpolation: {
|
|
escapeValue: false,
|
|
},
|
|
|
|
detection: {
|
|
order: ['localStorage', 'navigator', 'htmlTag'],
|
|
caches: ['localStorage'],
|
|
},
|
|
});
|
|
|
|
export default i18n; |