feat: soporte multi idioma en la web (infraestructura)
i18next + react-i18next con es-AR (fuente), es-419, pt-BR y en; el idioma sale del dispositivo (fallback a inglés) y se puede cambiar en Ajustes. La elección se guarda en localStorage y, para el profe, en users.locale. Las validaciones de shared pasan a claves y los errores de la API se traducen por code (con params para límites de plan y cupo). Migrados: layout, Ajustes, auth, PWA y lib/format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Link, useLocation } from '@tanstack/react-router'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { cn } from '../../lib/utils'
|
||||
import { Logo } from '../brand'
|
||||
import { NavBadge } from './NavBadge'
|
||||
@@ -6,6 +7,7 @@ import { isNavItemActive, NAV_ITEMS } from './nav-items'
|
||||
|
||||
export function Sidebar({ immersive = false }: { immersive?: boolean }) {
|
||||
const location = useLocation()
|
||||
const { t } = useTranslation('layout')
|
||||
|
||||
return (
|
||||
// Without the global header there's nothing to clear above: the sidebar
|
||||
@@ -19,12 +21,12 @@ export function Sidebar({ immersive = false }: { immersive?: boolean }) {
|
||||
>
|
||||
{/* `Link` and not `<a>`: an anchor would reload the document and lose the
|
||||
in-memory state (React Query cache, install event). */}
|
||||
<Link to="/" className="mb-8 flex items-center px-1" aria-label="Gruperly inicio">
|
||||
<Link to="/" className="mb-8 flex items-center px-1" aria-label={t('homeLink')}>
|
||||
<Logo className="h-10" />
|
||||
</Link>
|
||||
|
||||
<nav className="flex flex-col gap-1">
|
||||
{NAV_ITEMS.map(({ label, to, icon: Icon, badge }) => {
|
||||
{NAV_ITEMS.map(({ labelKey, to, icon: Icon, badge }) => {
|
||||
const isActive = isNavItemActive(location.pathname, to)
|
||||
return (
|
||||
<Link
|
||||
@@ -39,7 +41,7 @@ export function Sidebar({ immersive = false }: { immersive?: boolean }) {
|
||||
)}
|
||||
>
|
||||
<Icon className="size-5" strokeWidth={isActive ? 2.2 : 2} />
|
||||
{label}
|
||||
{t(labelKey)}
|
||||
{badge ? <NavBadge kind={badge} className="ml-auto" /> : null}
|
||||
</Link>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user