From 1aafa143dbd1a4ab4a971939772d9cf37c57fbc1 Mon Sep 17 00:00:00 2001 From: Kevin_Ramirez Date: Tue, 12 May 2026 09:42:40 -0500 Subject: [PATCH] Traducciones corregidas en porveedored y clientes --- frontend/messages/en.json | 5 + frontend/messages/es.json | 5 + .../clients_and_providers/+page.svelte | 85 +++++----- .../edit/[[id]]/+page.svelte | 148 +++++++++--------- 4 files changed, 135 insertions(+), 108 deletions(-) diff --git a/frontend/messages/en.json b/frontend/messages/en.json index d24b48c9..669bd3ba 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -1801,5 +1801,10 @@ "th_reason": "Reason", "download_csv": "Download CSV" } + }, + "clients_providers": { + "type_client": "Client", + "type_provider": "Provider", + "type_both": "Both" } } \ No newline at end of file diff --git a/frontend/messages/es.json b/frontend/messages/es.json index 708f548a..2d8f78e9 100644 --- a/frontend/messages/es.json +++ b/frontend/messages/es.json @@ -1801,5 +1801,10 @@ "th_reason": "Motivo", "download_csv": "Descargar CSV" } + }, + "clients_providers": { + "type_client": "Cliente", + "type_provider": "Proveedor", + "type_both": "Ambos" } } diff --git a/frontend/src/routes/dashboard/clients_and_providers/+page.svelte b/frontend/src/routes/dashboard/clients_and_providers/+page.svelte index 9e756f3b..5976c7c8 100644 --- a/frontend/src/routes/dashboard/clients_and_providers/+page.svelte +++ b/frontend/src/routes/dashboard/clients_and_providers/+page.svelte @@ -23,11 +23,28 @@ canDeleteClientsAndProviders, canEditClientsAndProviders } from '$lib/permissions/clients-providers-permissions'; + import { m } from '$lib/i18n/messages'; + import { getLocale } from '$lib/paraglide/runtime.js'; const canCreatePartner = $derived(canCreateClientsAndProviders($currentUser)); const canEditPartner = $derived(canEditClientsAndProviders($currentUser)); const canDeletePartner = $derived(canDeleteClientsAndProviders($currentUser)); + const typeLabels: Record = $derived({ + client: getLocale() === 'en' ? 'Client' : 'Cliente', + provider: getLocale() === 'en' ? 'Provider' : 'Proveedor', + both: getLocale() === 'en' ? 'Both' : 'Ambos' + }); + + const statusLabels = $derived({ + active: getLocale() === 'en' ? 'Active' : 'Activo', + inactive: getLocale() === 'en' ? 'Inactive' : 'Inactivo' + }); + + function t(es: string, en: string) { + return getLocale() === 'en' ? en : es; + } + // Los datos iniciales vienen del servidor let { data }: { data: any } = $props(); @@ -232,9 +249,9 @@
-

CLIENTES Y PROVEEDORES

+

{t('Clientes y Proveedores', 'Clients and Providers')}

- Gestiona el catálogo de clientes y proveedores de tu empresa + {t('Gestiona el catálogo de clientes y proveedores de tu empresa', 'Manage your company\'s client and provider catalog')}

@@ -259,15 +276,15 @@
-

Filtros

- Busque por nombre, RFC/TAX-ID o tipo +

{t('Filtros', 'Filters')}

+ {t('Busque por nombre, RFC/TAX-ID o tipo', 'Search by name, RFC/TAX-ID or type')}
- +
@@ -334,13 +351,13 @@ {#if isLoading && allItems.length === 0} Cargando...{t('Cargando...', 'Loading...')} {:else if allItems.length === 0} No se encontraron registros{t('No se encontraron registros', 'No records found')} {:else} @@ -357,22 +374,14 @@ {item.rfc} {item.name} - {#if item.client_or_provider === 'client'} - Cliente - {:else if item.client_or_provider === 'provider'} - Proveedor - {:else} - Ambos - {/if} + + {typeLabels[item.client_or_provider] || item.client_or_provider} + - {item.is_active ? 'Activo' : 'Inactivo'} + {item.is_active ? statusLabels.active : statusLabels.inactive} @@ -391,9 +400,9 @@
{#if isLoading} - Cargando más registros... + {t('Cargando más registros...', 'Loading more records...')} {:else} - Desplázate para cargar más + {t('Desplázate para cargar más', 'Scroll to load more')} {/if}
@@ -404,7 +413,7 @@
- Mostrando {allItems.length} de {totalItems} + {t('Mostrando', 'Showing')} {allItems.length} {t('de', 'of')} {totalItems}
@@ -416,7 +425,7 @@ >

- Detalles del Registro + {t('Detalles del Registro', 'Record Details')}

Tipo -

{selectedItem.client_or_provider}

+

+ {typeLabels[selectedItem.client_or_provider] || selectedItem.client_or_provider} +

{#if selectedItem.address} @@ -447,7 +458,7 @@

@@ -469,7 +480,7 @@ {#if selectedItem.address.email}

@@ -488,7 +499,7 @@
-

Sin dirección registrada

+

{t('Sin dirección registrada', 'No address registered')}

{/if} @@ -497,15 +508,15 @@
- Programa + {t('Programa', 'Program')} {selectedItem.programs.program || '-'}
- Número + {t('Número', 'Number')} {selectedItem.programs.program_number || '-'}
@@ -517,7 +528,7 @@ class="flex flex-col items-center justify-center h-full text-center text-muted-foreground opacity-50" > -

Selecciona un registro

+

{t('Selecciona un registro', 'Select a record')}

{/if}
diff --git a/frontend/src/routes/dashboard/clients_and_providers/edit/[[id]]/+page.svelte b/frontend/src/routes/dashboard/clients_and_providers/edit/[[id]]/+page.svelte index f5d26ae9..27af838d 100644 --- a/frontend/src/routes/dashboard/clients_and_providers/edit/[[id]]/+page.svelte +++ b/frontend/src/routes/dashboard/clients_and_providers/edit/[[id]]/+page.svelte @@ -2,6 +2,8 @@ import { onMount } from 'svelte'; import { page } from '$app/stores'; import { goto } from '$app/navigation'; + import { getLocale } from '$lib/paraglide/runtime.js'; + import { m } from '$lib/i18n/messages'; // Componentes UI import { Button } from '$lib/components/ui/button'; @@ -69,11 +71,15 @@ // State for Tabs let activeTab = $state('general'); - const typeLabels: Record = { - client: 'Cliente', - provider: 'Proveedor', - both: 'Ambos' - }; + const typeLabels: Record = $derived({ + client: getLocale() === 'en' ? 'Client' : 'Cliente', + provider: getLocale() === 'en' ? 'Provider' : 'Proveedor', + both: getLocale() === 'en' ? 'Both' : 'Ambos' + }); + + function t(es: string, en: string) { + return getLocale() === 'en' ? en : es; + } // --- ESTADO INICIAL (PLANO) --- const getEmptyForm = () => ({ @@ -207,12 +213,12 @@ return; } if (!companyStore.activeCompany) { - error = 'Selecciona una compañía'; + error = t('Selecciona una compañía', 'Select a company'); toast.error(error); return; } if (!formData.rfc.trim() || !formData.name.trim()) { - error = 'Identificador fiscal (RFC/TAX-ID) y Nombre son obligatorios'; + error = t('Identificador fiscal (RFC/TAX-ID) y Nombre son obligatorios', 'Tax Identifier (RFC/TAX-ID) and Name are required'); toast.error(error); return; } @@ -283,7 +289,7 @@ if (response.error) throw new Error(response.error); toast.success( - isEditing ? 'Registro actualizado correctamente' : 'Registro creado correctamente' + isEditing ? t('Registro actualizado correctamente', 'Record updated successfully') : t('Registro creado correctamente', 'Record created successfully') ); goto('/dashboard/clients_and_providers'); } catch (e: any) { @@ -328,20 +334,20 @@

- {isEditing ? `Socio Comercial #${id}` : 'Nuevo Socio Comercial'} + {isEditing ? `${t('Socio Comercial', 'Business Partner')} #${id}` : t('Nuevo Socio Comercial', 'New Business Partner')}

{#if isEditing} - {formData.is_active ? 'Activo' : 'Inactivo'} + {formData.is_active ? t('Activo', 'Active') : t('Inactivo', 'Inactive')} {:else} - Nuevo + {t('Nuevo', 'New')} {/if}

{isEditing - ? 'Edita la información del cliente o proveedor' - : 'Registra un nuevo cliente o proveedor en el sistema'} + ? t('Edita la información del cliente o proveedor', 'Edit client or provider information') + : t('Registra un nuevo cliente o proveedor en el sistema', 'Register a new client or provider in the system')}

@@ -362,9 +368,9 @@ - Información General + {t('Información General', 'General Information')} Datos principales de identificación y clasificación.{t('Datos principales de identificación y clasificación.', 'Primary identification and classification data.')} @@ -387,12 +393,12 @@ onValueChange={(v) => (formData.client_or_provider = v)} > - {typeLabels[formData.client_or_provider] || 'Selecciona un tipo'} + {typeLabels[formData.client_or_provider] || t('Selecciona un tipo', 'Select a type')} - Cliente - Proveedor - Ambos + {t('Cliente', 'Client')} + {t('Proveedor', 'Provider')} + {t('Ambos', 'Both')} @@ -400,11 +406,11 @@
- + @@ -435,14 +441,14 @@ > {formData.type_nat_foreign === 'N' - ? 'Nacional' + ? t('Nacional', 'National') : formData.type_nat_foreign === 'E' - ? 'Extranjero' - : 'Seleccione'} + ? t('Extranjero', 'Foreign') + : t('Seleccione', 'Select')} - Nacional - Extranjero + {t('Nacional', 'National')} + {t('Extranjero', 'Foreign')}
@@ -450,11 +456,11 @@
- +
- +
@@ -466,13 +472,13 @@ - Dirección y Contacto - Ubicación fiscal y datos de contacto. + {t('Dirección y Contacto', 'Address and Contact')} + {t('Ubicación fiscal y datos de contacto.', 'Fiscal location and contact details.')}
- +
- +
- +
- +
- +
- +
- +
- +
(stateModalOpen = true)} disabled={loading} - title="Buscar Estado" + title={t('Buscar Estado', 'Search State')} >
- +
(countryModalOpen = true)} disabled={loading} - title="Buscar País" + title={t('Buscar País', 'Search Country')} > @@ -584,11 +590,11 @@
- +
- +
@@ -600,9 +606,9 @@ - Programas y Certificaciones + {t('Programas y Certificaciones', 'Programs and Certifications')} Información sobre IMMEX, PROSEC y otras certificaciones.{t('Información sobre IMMEX, PROSEC y otras certificaciones.', 'Information about IMMEX, PROSEC and other certifications.')} @@ -610,14 +616,14 @@
- Programas de Fomento + {t('Programas de Fomento', 'Promotion Programs')}
- {formData.program || 'Selecciona un programa'} + {formData.program || t('Selecciona un programa', 'Select a program')} {#each scaiiPrograms as prog} @@ -640,20 +646,20 @@
(sectorModalOpen = true)} disabled={loading} - title="Buscar Sector" + title={t('Buscar Sector', 'Search Sector')} > @@ -692,7 +698,7 @@
- Identificación Industrial + {t('Identificación Industrial', 'Industrial Identification')}
@@ -706,7 +712,7 @@ bind:value={formData.manufacturer_id} maxlength={25} disabled={loading} - placeholder="P. ej. MXABCD12345" + placeholder={t('P. ej. MXABCD12345', 'E.g. MXABCD12345')} />
@@ -716,7 +722,7 @@
- Certificaciones y Seguridad + {t('Certificaciones y Seguridad', 'Certifications and Security')}
@@ -730,7 +736,7 @@ bind:value={formData.ctpat_svi} maxlength={100} disabled={loading} - placeholder="P. ej. SVI-12345" + placeholder={t('P. ej. SVI-12345', 'E.g. SVI-12345')} />
@@ -740,9 +746,9 @@ disabled={loading} />
- +

- Indica si cuenta con certificación de empresa + {t('Indica si cuenta con certificación de empresa', 'Indicates if it has company certification')}

@@ -756,17 +762,17 @@ - Configuración - Ajustes de estado y atributos especiales. + {t('Configuración', 'Settings')} + {t('Ajustes de estado y atributos especiales.', 'Status settings and special attributes.')}
- +

- Habilitar o deshabilitar este socio comercial + {t('Habilitar o deshabilitar este socio comercial', 'Enable or disable this business partner')}

@@ -789,16 +795,16 @@
- General + {t('General', 'General')} - Dirección + {t('Dirección', 'Address')} - Programas + {t('Programas', 'Programs')} - Config + {t('Config', 'Config')}
@@ -806,20 +812,20 @@
- + {#if !isEditing} {/if}