From 44979cc34e9876515c718f57e51a3c570dc45695 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 11 Oct 2025 02:31:31 +0000 Subject: [PATCH] feat: Implement internationalization --- src/components/CurrencySelector.tsx | 2 +- src/components/DashboardLayout.tsx | 4 + src/components/LanguageSelector.tsx | 38 ++++ src/contexts/LanguageContext.tsx | 2 +- src/i18n/translations.ts | 291 +++++++++++++++++++++++++++- 5 files changed, 332 insertions(+), 5 deletions(-) create mode 100644 src/components/LanguageSelector.tsx diff --git a/src/components/CurrencySelector.tsx b/src/components/CurrencySelector.tsx index 9db238c..212f768 100644 --- a/src/components/CurrencySelector.tsx +++ b/src/components/CurrencySelector.tsx @@ -21,7 +21,7 @@ const CurrencySelector = () => { - + {currencies.map((curr) => ( diff --git a/src/components/DashboardLayout.tsx b/src/components/DashboardLayout.tsx index 73998d6..478d0cd 100644 --- a/src/components/DashboardLayout.tsx +++ b/src/components/DashboardLayout.tsx @@ -4,6 +4,7 @@ import { useAuth } from '@/contexts/AuthContext'; import { useLanguage } from '@/contexts/LanguageContext'; import DashboardStyles from '@/components/layouts/DashboardStyles'; import CurrencySelector from '@/components/CurrencySelector'; +import LanguageSelector from '@/components/LanguageSelector'; import { Home, Plus, @@ -480,6 +481,9 @@ const DashboardLayout = ({ children }: { children: React.ReactNode }) => { {/* Right Side */}
+ {/* Language Selector */} + + {/* Currency Selector */} diff --git a/src/components/LanguageSelector.tsx b/src/components/LanguageSelector.tsx new file mode 100644 index 0000000..b6341ce --- /dev/null +++ b/src/components/LanguageSelector.tsx @@ -0,0 +1,38 @@ +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; +import { useLanguage } from '@/contexts/LanguageContext'; +import { Globe } from 'lucide-react'; + +type Language = 'en' | 'es' | 'fr'; + +const languages: { value: Language; label: string; flag: string }[] = [ + { value: 'en', label: 'English', flag: '🇺🇸' }, + { value: 'es', label: 'Español', flag: '🇪🇸' }, + { value: 'fr', label: 'Français', flag: '🇫🇷' } +]; + +const LanguageSelector = () => { + const { language, setLanguage } = useLanguage(); + + return ( +
+ + +
+ ); +}; + +export default LanguageSelector; diff --git a/src/contexts/LanguageContext.tsx b/src/contexts/LanguageContext.tsx index 1344f1e..890fe31 100644 --- a/src/contexts/LanguageContext.tsx +++ b/src/contexts/LanguageContext.tsx @@ -15,7 +15,7 @@ const LanguageContext = createContext(undefined export const LanguageProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => { const [language, setLanguageState] = useState(() => { const saved = localStorage.getItem('karibeo-language'); - return (saved as Language) || 'es'; + return (saved as Language) || 'en'; }); const setLanguage = (lang: Language) => { diff --git a/src/i18n/translations.ts b/src/i18n/translations.ts index e06eaea..0d6089f 100644 --- a/src/i18n/translations.ts +++ b/src/i18n/translations.ts @@ -71,6 +71,10 @@ export const translations = { delete: 'Eliminar', edit: 'Editar', view: 'Ver', + search: 'Buscar', + add: 'Agregar', + create: 'Crear', + update: 'Actualizar', // Process section processTitle: 'Encuentra Tu Lugar Soñado De La Mejor Manera', @@ -82,7 +86,98 @@ export const translations = { // Explore section topRegions: 'Principales Regiones', exploreCities: 'Explorar Ciudades', - exploreMore: 'Explorar más' + exploreMore: 'Explorar más', + + // Commerce Module + commerce: 'Comercios', + myStore: 'Mi Comercio', + posTerminal: 'POS Ventas', + inventory: 'Inventario', + customers: 'Clientes', + staff: 'Personal', + cashier: 'Caja', + reports: 'Reportes', + sales: 'Ventas', + + // Store + storeInfo: 'Información de la tienda', + storeName: 'Nombre del Comercio', + storeDescription: 'Descripción', + storeCategory: 'Categoría', + storeAddress: 'Dirección', + storePhone: 'Teléfono', + storeEmail: 'Email', + storeWebsite: 'Sitio Web', + openingHours: 'Horario de Atención', + storeStatus: 'Estado del Comercio', + active: 'Activo', + inactive: 'Inactivo', + basicInfo: 'Información Básica', + contactInfo: 'Información de Contacto', + + // Inventory + product: 'Producto', + products: 'Productos', + productName: 'Nombre del Producto', + category: 'Categoría', + price: 'Precio', + stock: 'Stock', + quantity: 'Cantidad', + unit: 'Unidad', + minStock: 'Stock Mínimo', + supplier: 'Proveedor', + barcode: 'Código de Barras', + lowStock: 'Stock Bajo', + + // POS + currentSale: 'Venta Actual', + processPay: 'Procesar Pago', + total: 'Total', + cartEmpty: 'El carrito está vacío', + noProducts: 'No hay productos', + addProducts: 'Agrega productos desde la sección de Inventario', + + // Customers + customer: 'Cliente', + customerName: 'Nombre del Cliente', + customerEmail: 'Email del Cliente', + customerPhone: 'Teléfono del Cliente', + customerAddress: 'Dirección del Cliente', + totalPurchases: 'Total compras', + customerSince: 'Cliente desde', + + // Staff + employee: 'Empleado', + employees: 'Empleados', + firstName: 'Nombre', + lastName: 'Apellido', + role: 'Rol', + salary: 'Salario', + + // Cashier + cashierControl: 'Control de Caja', + openingBalance: 'Saldo Inicial', + currentBalance: 'Saldo Actual', + dailySales: 'Ventas del Día', + expenses: 'Gastos', + openCashier: 'Abrir Caja', + closeCashier: 'Cerrar Caja', + transaction: 'Transacción', + transactionType: 'Tipo de Transacción', + amount: 'Monto', + description: 'Descripción', + registerTransaction: 'Registrar Transacción', + recentTransactions: 'Transacciones Recientes', + + // Days of week + monday: 'Lunes', + tuesday: 'Martes', + wednesday: 'Miércoles', + thursday: 'Jueves', + friday: 'Viernes', + saturday: 'Sábado', + sunday: 'Domingo', + closed: 'Cerrado' }, en: { @@ -157,6 +252,10 @@ export const translations = { delete: 'Delete', edit: 'Edit', view: 'View', + search: 'Search', + add: 'Add', + create: 'Create', + update: 'Update', // Process section processTitle: 'Find Your Dream Place The Best Way', @@ -168,7 +267,98 @@ export const translations = { // Explore section topRegions: 'Top Regions', exploreCities: 'Explore Cities', - exploreMore: 'Explore more' + exploreMore: 'Explore more', + + // Commerce Module + commerce: 'Commerce', + myStore: 'My Store', + posTerminal: 'POS Sales', + inventory: 'Inventory', + customers: 'Customers', + staff: 'Staff', + cashier: 'Cashier', + reports: 'Reports', + sales: 'Sales', + + // Store + storeInfo: 'Store information', + storeName: 'Store Name', + storeDescription: 'Description', + storeCategory: 'Category', + storeAddress: 'Address', + storePhone: 'Phone', + storeEmail: 'Email', + storeWebsite: 'Website', + openingHours: 'Opening Hours', + storeStatus: 'Store Status', + active: 'Active', + inactive: 'Inactive', + basicInfo: 'Basic Information', + contactInfo: 'Contact Information', + + // Inventory + product: 'Product', + products: 'Products', + productName: 'Product Name', + category: 'Category', + price: 'Price', + stock: 'Stock', + quantity: 'Quantity', + unit: 'Unit', + minStock: 'Minimum Stock', + supplier: 'Supplier', + barcode: 'Barcode', + lowStock: 'Low Stock', + + // POS + currentSale: 'Current Sale', + processPay: 'Process Payment', + total: 'Total', + cartEmpty: 'Cart is empty', + noProducts: 'No products', + addProducts: 'Add products from Inventory section', + + // Customers + customer: 'Customer', + customerName: 'Customer Name', + customerEmail: 'Customer Email', + customerPhone: 'Customer Phone', + customerAddress: 'Customer Address', + totalPurchases: 'Total purchases', + customerSince: 'Customer since', + + // Staff + employee: 'Employee', + employees: 'Employees', + firstName: 'First Name', + lastName: 'Last Name', + role: 'Role', + salary: 'Salary', + + // Cashier + cashierControl: 'Cash Register Control', + openingBalance: 'Opening Balance', + currentBalance: 'Current Balance', + dailySales: 'Daily Sales', + expenses: 'Expenses', + openCashier: 'Open Register', + closeCashier: 'Close Register', + transaction: 'Transaction', + transactionType: 'Transaction Type', + amount: 'Amount', + description: 'Description', + registerTransaction: 'Register Transaction', + recentTransactions: 'Recent Transactions', + + // Days of week + monday: 'Monday', + tuesday: 'Tuesday', + wednesday: 'Wednesday', + thursday: 'Thursday', + friday: 'Friday', + saturday: 'Saturday', + sunday: 'Sunday', + closed: 'Closed' }, fr: { @@ -243,6 +433,10 @@ export const translations = { delete: 'Supprimer', edit: 'Modifier', view: 'Voir', + search: 'Rechercher', + add: 'Ajouter', + create: 'Créer', + update: 'Mettre à jour', // Process section processTitle: 'Trouvez Votre Lieu de Rêve de la Meilleure Façon', @@ -254,6 +448,97 @@ export const translations = { // Explore section topRegions: 'Principales Régions', exploreCities: 'Explorer les Villes', - exploreMore: 'Explorer plus' + exploreMore: 'Explorer plus', + + // Commerce Module + commerce: 'Commerce', + myStore: 'Mon Magasin', + posTerminal: 'POS Ventes', + inventory: 'Inventaire', + customers: 'Clients', + staff: 'Personnel', + cashier: 'Caisse', + reports: 'Rapports', + sales: 'Ventes', + + // Store + storeInfo: 'Informations du magasin', + storeName: 'Nom du Magasin', + storeDescription: 'Description', + storeCategory: 'Catégorie', + storeAddress: 'Adresse', + storePhone: 'Téléphone', + storeEmail: 'Email', + storeWebsite: 'Site Web', + openingHours: 'Heures d\'Ouverture', + storeStatus: 'Statut du Magasin', + active: 'Actif', + inactive: 'Inactif', + basicInfo: 'Informations de Base', + contactInfo: 'Coordonnées', + + // Inventory + product: 'Produit', + products: 'Produits', + productName: 'Nom du Produit', + category: 'Catégorie', + price: 'Prix', + stock: 'Stock', + quantity: 'Quantité', + unit: 'Unité', + minStock: 'Stock Minimum', + supplier: 'Fournisseur', + barcode: 'Code-barres', + lowStock: 'Stock Faible', + + // POS + currentSale: 'Vente Actuelle', + processPay: 'Traiter le Paiement', + total: 'Total', + cartEmpty: 'Le panier est vide', + noProducts: 'Aucun produit', + addProducts: 'Ajoutez des produits depuis la section Inventaire', + + // Customers + customer: 'Client', + customerName: 'Nom du Client', + customerEmail: 'Email du Client', + customerPhone: 'Téléphone du Client', + customerAddress: 'Adresse du Client', + totalPurchases: 'Total des achats', + customerSince: 'Client depuis', + + // Staff + employee: 'Employé', + employees: 'Employés', + firstName: 'Prénom', + lastName: 'Nom', + role: 'Rôle', + salary: 'Salaire', + + // Cashier + cashierControl: 'Contrôle de Caisse', + openingBalance: 'Solde d\'Ouverture', + currentBalance: 'Solde Actuel', + dailySales: 'Ventes du Jour', + expenses: 'Dépenses', + openCashier: 'Ouvrir la Caisse', + closeCashier: 'Fermer la Caisse', + transaction: 'Transaction', + transactionType: 'Type de Transaction', + amount: 'Montant', + description: 'Description', + registerTransaction: 'Enregistrer la Transaction', + recentTransactions: 'Transactions Récentes', + + // Days of week + monday: 'Lundi', + tuesday: 'Mardi', + wednesday: 'Mercredi', + thursday: 'Jeudi', + friday: 'Vendredi', + saturday: 'Samedi', + sunday: 'Dimanche', + closed: 'Fermé' } }; \ No newline at end of file