From 45f6e99770e8e82bbd2542f4775cd4c59fc0c021 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Mon, 9 Feb 2026 01:19:47 +0000 Subject: [PATCH] Auto commit: 2026-02-09T01:19:47.913Z --- frontend/public/locales/es/common.json | 34 +++++++++++-- frontend/src/components/AsideMenuItem.tsx | 6 ++- frontend/src/components/LanguageSwitcher.tsx | 19 ++++++-- frontend/src/components/NavBarItem.tsx | 8 +-- frontend/src/i18n.ts | 5 +- frontend/src/layouts/Authenticated.tsx | 6 ++- frontend/src/pages/dashboard.tsx | 28 ++++++----- frontend/src/pages/login.tsx | 51 +++++++++++--------- 8 files changed, 106 insertions(+), 51 deletions(-) diff --git a/frontend/public/locales/es/common.json b/frontend/public/locales/es/common.json index f3421b1..cb11145 100644 --- a/frontend/public/locales/es/common.json +++ b/frontend/public/locales/es/common.json @@ -1,4 +1,29 @@ { + "menu": { + "Dashboard": "Tablero", + "Users": "Usuarios", + "Roles": "Roles", + "Permissions": "Permisos", + "Medical centers": "Centros médicos", + "Services": "Servicios", + "Patients": "Pacientes", + "Appointments": "Turnos", + "Payments": "Pagos", + "Settlements": "Liquidaciones", + "Expenses": "Gastos", + "Extra incomes": "Ingresos extras", + "Messages": "Mensajes", + "Pdf templates": "Plantillas PDF", + "Pdf documents": "Documentos PDF", + "Event logs": "Registros de eventos", + "App settings": "Configuración", + "Profile": "Perfil", + "Swagger API": "API Swagger", + "My Profile": "Mi Perfil", + "Log Out": "Cerrar sesión", + "Log out": "Cerrar sesión", + "Light/Dark": "Claro/Oscuro" + }, "pages": { "dashboard": { "pageTitle": "Tablero", @@ -9,8 +34,8 @@ "login": { "pageTitle": "Inicio de sesión", - "sampleCredentialsAdmin": "Use {{email}} / {{password}} para iniciar sesión como Administrador", - "sampleCredentialsUser": "Use {{email}} / {{password}} para iniciar sesión como Usuario", + "sampleCredentialsAdmin": "Use / para iniciar sesión como Administrador", + "sampleCredentialsUser": "Use / para iniciar sesión como Usuario", "form": { "loginLabel": "Usuario", @@ -20,6 +45,7 @@ "remember": "Recuérdame", "forgotPassword": "¿Olvidó su contraseña?", "loginButton": "Acceder", + "loginWithGoogle": "Ingresar con Google", "loading": "Cargando...", "noAccountYet": "¿Aún no tiene una cuenta?", "newAccount": "Crear cuenta" @@ -40,7 +66,7 @@ "components": { "widgetCreator": { "title": "Crear gráfico o widget", - "helpText": "Describe tu nuevo widget o gráfico en lenguaje natural. Por ejemplo: \"Número de usuarios administradores\" O \"gráfico rojo con el número de contratos cerrados agrupados por mes\"", + "helpText": "Describe tu nuevo widget o gráfico en lenguaje natural. Por ejemplo: \"Número de usuarios administradores\" O \"gráfico rojo con el número de contratos cerrados agrupados por mes"", "settingsTitle": "Configuración del creador de widgets", "settingsDescription": "¿Para qué rol estamos mostrando y creando widgets?", "doneButton": "Listo", @@ -52,4 +78,4 @@ "minLength": "Longitud mínima: {{count}} caracteres" } } -} +} \ No newline at end of file diff --git a/frontend/src/components/AsideMenuItem.tsx b/frontend/src/components/AsideMenuItem.tsx index dbb09b2..c42f9eb 100644 --- a/frontend/src/components/AsideMenuItem.tsx +++ b/frontend/src/components/AsideMenuItem.tsx @@ -7,6 +7,7 @@ import AsideMenuList from './AsideMenuList' import { MenuAsideItem } from '../interfaces' import { useAppSelector } from '../stores/hooks' import { useRouter } from 'next/router' +import { useTranslation } from 'react-i18next' type Props = { item: MenuAsideItem @@ -14,6 +15,7 @@ type Props = { } const AsideMenuItem = ({ item, isDropdownList = false }: Props) => { + const { t } = useTranslation('common') const [isLinkActive, setIsLinkActive] = useState(false) const [isDropdownActive, setIsDropdownActive] = useState(false) @@ -50,7 +52,7 @@ const AsideMenuItem = ({ item, isDropdownList = false }: Props) => { item.menu ? '' : 'pr-12' } ${activeClassAddon}`} > - {item.label} + {t(`menu.${item.label}`, item.label)} {item.menu && ( { ) } -export default AsideMenuItem +export default AsideMenuItem \ No newline at end of file diff --git a/frontend/src/components/LanguageSwitcher.tsx b/frontend/src/components/LanguageSwitcher.tsx index f2f373a..3715264 100644 --- a/frontend/src/components/LanguageSwitcher.tsx +++ b/frontend/src/components/LanguageSwitcher.tsx @@ -1,5 +1,6 @@ import React, { useEffect, useState } from 'react'; import Select, { components, SingleValueProps, OptionProps } from 'react-select'; +import { useTranslation } from 'react-i18next'; type LanguageOption = { label: string; value: string }; @@ -23,28 +24,37 @@ const SingleVal = (props: SingleValueProps) => ( ); const LanguageSwitcher: React.FC = () => { + const { i18n } = useTranslation(); const [mounted, setMounted] = useState(false); - const [selected, setSelected] = useState(LANGS[0]); + const [selected, setSelected] = useState(LANGS.find(l => l.value === i18n.language) || LANGS[0]); useEffect(() => { setMounted(true); }, []); + useEffect(() => { + const currentLang = LANGS.find(l => l.value === i18n.language); + if (currentLang) { + setSelected(currentLang); + } + }, [i18n.language]); + const handleChange = (opt: LanguageOption | null) => { if (!opt) return; setSelected(opt); + i18n.changeLanguage(opt.value); }; if (!mounted) return null; return ( -
+