feat(i18n): traducir Cobros

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jose Selesan
2026-11-03 13:53:40 -03:00
parent 13723d5bb9
commit 7db9414f12
15 changed files with 344 additions and 66 deletions

View File

@@ -1,9 +1,11 @@
import { Link } from '@tanstack/react-router'
import { Plus } from 'lucide-react'
import { cn } from '../../lib/utils'
import { useTranslation } from 'react-i18next'
/* Pie del selector de grupos de Cobros: lleva al alta de grupo. */
export function CreateGroupLink({ compact = false }: { compact?: boolean }) {
const { t } = useTranslation('payments')
return (
<Link
to="/groups/new"
@@ -13,7 +15,7 @@ export function CreateGroupLink({ compact = false }: { compact?: boolean }) {
)}
>
<Plus className="size-4" aria-hidden="true" />
Crear un grupo nuevo
{t('groupFilter.create')}
</Link>
)
}

View File

@@ -5,6 +5,7 @@ import { cn } from '../../lib/utils'
import { CreateGroupLink } from './CreateGroupLink'
import { GroupOptionList } from './GroupOptionList'
import { usePayments } from './PaymentsProvider'
import { useTranslation } from 'react-i18next'
/* Mismo corte que la fila de filtros: debajo de `lg` la fila scrollea en
horizontal y un popover absoluto quedaría recortado, así que ahí va el sheet. */
@@ -26,6 +27,7 @@ function useIsDesktop() {
export function GroupFilter() {
const { groups, groupId, setGroupId } = usePayments()
const [isOpen, setIsOpen] = useState(false)
const { t } = useTranslation('payments')
const isDesktop = useIsDesktop()
const rootRef = useRef<HTMLDivElement>(null)
const chipRef = useRef<HTMLButtonElement>(null)
@@ -72,7 +74,7 @@ export function GroupFilter() {
type="button"
aria-haspopup="listbox"
aria-expanded={isOpen}
aria-label={`Grupo: ${selected?.name ?? 'Todos los grupos'}`}
aria-label={t('groupFilter.label', { name: selected?.name ?? t('groupFilter.all') })}
onClick={() => setIsOpen((open) => !open)}
className={cn(
'flex items-center gap-1.5 rounded-full border px-3.5 py-1.5 text-sm font-medium transition-colors',
@@ -83,7 +85,7 @@ export function GroupFilter() {
)}
>
<Users className="size-4 shrink-0" aria-hidden="true" />
<span className="max-w-[12rem] truncate">{selected?.name ?? 'Todos los grupos'}</span>
<span className="max-w-[12rem] truncate">{selected?.name ?? t('groupFilter.all')}</span>
<ChevronDown
className={cn(
'size-4 shrink-0 transition-transform motion-reduce:transition-none',
@@ -96,7 +98,7 @@ export function GroupFilter() {
{isDesktop ? (
isOpen ? (
<div className="absolute left-0 top-full z-40 mt-1.5 w-80 animate-fade-in rounded-xl border border-border bg-surface p-1.5 shadow-lg">
<p className="px-2.5 py-1.5 text-xs font-medium text-foreground/50">Grupos</p>
<p className="px-2.5 py-1.5 text-xs font-medium text-foreground/50">{t('groupFilter.groups')}</p>
<div className="max-h-80 overflow-y-auto">{list}</div>
<div className="mt-1.5 border-t border-border pt-1.5">
<CreateGroupLink compact />
@@ -104,7 +106,7 @@ export function GroupFilter() {
</div>
) : null
) : (
<Sheet isOpen={isOpen} onClose={close} title="Elegir grupo">
<Sheet isOpen={isOpen} onClose={close} title={t('groupFilter.choose')}>
{list}
<div className="mt-3 border-t border-border pt-2">
<CreateGroupLink />

View File

@@ -2,8 +2,10 @@ import type { GroupListItem } from '@gruperly/shared'
import { Check, LayoutGrid } from 'lucide-react'
import { useEffect, useRef, useState, type KeyboardEvent } from 'react'
import { Avatar, Badge } from '../../components/ui'
import { i18n } from '../../i18n/instance'
import { formatPrice } from '../../lib/format'
import { cn } from '../../lib/utils'
import { useTranslation } from 'react-i18next'
type GroupOptionListProps = {
groups: GroupListItem[]
@@ -20,26 +22,28 @@ type Option = {
unpaid: number
}
function plural(count: number, singular: string, pluralForm: string): string {
return `${count} ${count === 1 ? singular : pluralForm}`
}
function groupSubtitle(group: GroupListItem): string {
const members = plural(group.attendeesCount, 'miembro', 'miembros')
const members = i18n.t('payments:groupFilter.members', { count: group.attendeesCount })
if (group.price == null) return members
const unit = group.billingType === 'PER_CLASS' ? '/clase' : '/mes'
return `${members} · ${formatPrice(group.price)}${unit}`
const price = formatPrice(group.price)
const priced =
group.billingType === 'PER_CLASS'
? i18n.t('payments:groupFilter.perClass', { price })
: i18n.t('payments:groupFilter.perMonth', { price })
return `${members} · ${priced}`
}
/* Lista de grupos del filtro de Cobros, compartida por el bottom sheet y el
dropdown. Foco "roving": la opción activa es la única tabulable y las flechas
mueven el foco real, así el lector de pantalla lee cada opción. */
export function GroupOptionList({ groups, selectedId, onSelect, compact = false }: GroupOptionListProps) {
const { t } = useTranslation('payments')
const options: Option[] = [
{
id: null,
name: 'Todos los grupos',
subtitle: plural(groups.length, 'grupo', 'grupos'),
name: t('groupFilter.all'),
subtitle: t('groupFilter.groupCount', { count: groups.length }),
unpaid: groups.reduce((sum, group) => sum + group.unpaidPaymentsCount, 0),
},
...groups.map((group) => ({
@@ -93,7 +97,7 @@ export function GroupOptionList({ groups, selectedId, onSelect, compact = false
}
return (
<ul role="listbox" aria-label="Grupos" onKeyDown={handleKeyDown} className="space-y-0.5">
<ul role="listbox" aria-label={t('groupFilter.groups')} onKeyDown={handleKeyDown} className="space-y-0.5">
{options.map((option, index) => {
const isSelected = option.id === selectedId
return (
@@ -131,7 +135,7 @@ export function GroupOptionList({ groups, selectedId, onSelect, compact = false
<span className="block truncate text-xs text-foreground/60">{option.subtitle}</span>
</span>
{option.unpaid > 0 ? (
<Badge variant="neutral" aria-label={plural(option.unpaid, 'cobro pendiente', 'cobros pendientes')}>
<Badge variant="neutral" aria-label={t('groupFilter.unpaid', { count: option.unpaid })}>
{option.unpaid}
</Badge>
) : null}

View File

@@ -5,6 +5,7 @@ import { Badge, Button } from '../../components/ui'
import { cn } from '../../lib/utils'
import { formatPrice, paymentStatusLabel } from '../../lib/format'
import { paymentDateLabel, paymentPeriodLabel, PAYMENT_STATUS_BADGE } from './copy'
import { useTranslation } from 'react-i18next'
type PaymentRowProps = {
payment: PaymentDto
@@ -16,6 +17,7 @@ type PaymentRowProps = {
export function PaymentRow({ payment, showGroup, isRenewing, onRenew }: PaymentRowProps) {
const [copied, setCopied] = useState(false)
const { t } = useTranslation(['payments', 'common'])
const canCopy = Boolean(payment.checkoutUrl)
const canRenew = !payment.checkoutUrl || payment.status === 'CANCELLED'
@@ -61,7 +63,7 @@ export function PaymentRow({ payment, showGroup, isRenewing, onRenew }: PaymentR
) : (
<Copy className="size-3.5 text-accent" />
)}
{copied ? 'Copiado' : 'Copiar link'}
{copied ? t('row.copied') : t('row.copyLink')}
</Button>
) : (
<span
@@ -71,7 +73,7 @@ export function PaymentRow({ payment, showGroup, isRenewing, onRenew }: PaymentR
)}
>
<Link2 className="size-3.5" />
Sin link
{t('row.noLink')}
</span>
)}
@@ -88,7 +90,7 @@ export function PaymentRow({ payment, showGroup, isRenewing, onRenew }: PaymentR
) : (
<RefreshCw className="size-3.5 text-accent" />
)}
Generar link
{t('row.generate')}
</Button>
) : null}
</div>

View File

@@ -2,7 +2,9 @@ import type { GroupListItem, PaymentDto, PaymentQuery, PaymentStatus } from '@gr
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import type { ReactNode } from 'react'
import { createContext, useContext, useMemo, useState } from 'react'
import { ApiError, getGroups, getPayments, renewPaymentLink } from '../../lib/api'
import { errorMessage as apiErrorMessage } from '../../i18n'
import { i18n } from '../../i18n/instance'
import { getGroups, getPayments, renewPaymentLink } from '../../lib/api'
export type PaymentFilterStatus = PaymentStatus | 'ALL'
@@ -85,9 +87,7 @@ export function PaymentsProvider({ children }: { children: ReactNode }) {
const pagination = data?.pagination
const errorMessage = paymentsQuery.isError
? paymentsQuery.error instanceof ApiError
? paymentsQuery.error.problem?.detail ?? 'No pudimos cargar tus cobros.'
: 'No pudimos cargar tus cobros.'
? apiErrorMessage(paymentsQuery.error, i18n.t('payments:loadError'))
: null
return (

View File

@@ -6,14 +6,10 @@ import { GroupFilter } from './GroupFilter'
import { PaymentRow } from './PaymentRow'
import { ReportedPaymentsSection } from './ReportedPaymentsSection'
import { usePayments } from './PaymentsProvider'
import { useTranslation } from 'react-i18next'
const STATUS_FILTERS: readonly { value: 'ALL' | PaymentStatus; label: string }[] = [
{ value: 'ALL', label: 'Todos' },
{ value: 'PENDING', label: 'Pendientes' },
{ value: 'PAID', label: 'Pagados' },
{ value: 'OVERDUE', label: 'Vencidos' },
{ value: 'CANCELLED', label: 'Anulados' },
]
/** Labels: `payments:filters.<value>`. */
const STATUS_FILTERS: readonly ('ALL' | PaymentStatus)[] = ['ALL', 'PENDING', 'PAID', 'OVERDUE', 'CANCELLED']
export function PaymentsView() {
const {
@@ -33,13 +29,14 @@ export function PaymentsView() {
renew,
isRenewing,
} = usePayments()
const { t } = useTranslation(['payments', 'common'])
return (
<section>
<div className="flex items-center justify-between gap-3">
<div>
<h1 className="text-2xl font-bold text-primary">Cobros</h1>
<p className="mt-1 text-sm text-foreground/60">Seguí los pagos de tus grupos.</p>
<h1 className="text-2xl font-bold text-primary">{t('title')}</h1>
<p className="mt-1 text-sm text-foreground/60">{t('subtitle')}</p>
</div>
</div>
@@ -50,16 +47,16 @@ export function PaymentsView() {
<div className="mt-5 flex items-center gap-2 overflow-x-auto lg:flex-wrap lg:overflow-visible">
<GroupFilter />
<span className="h-6 w-px shrink-0 bg-border" aria-hidden="true" />
<div role="tablist" aria-label="Filtrar por estado" className="flex gap-2 lg:flex-wrap">
<div role="tablist" aria-label={t('statusFilterLabel')} className="flex gap-2 lg:flex-wrap">
{STATUS_FILTERS.map((filter) => {
const isActive = status === filter.value
const isActive = status === filter
return (
<button
key={filter.value}
key={filter}
type="button"
role="tab"
aria-selected={isActive}
onClick={() => setStatus(filter.value)}
onClick={() => setStatus(filter)}
className={cn(
'shrink-0 rounded-full border px-3.5 py-1.5 text-sm font-medium transition-colors',
isActive
@@ -67,7 +64,7 @@ export function PaymentsView() {
: 'border-border bg-surface text-foreground/70 hover:text-primary',
)}
>
{filter.label}
{t(`filters.${filter}`)}
</button>
)
})}
@@ -77,7 +74,7 @@ export function PaymentsView() {
{isPending ? (
<div className="mt-8 flex items-center justify-center py-16" role="status">
<Loader2 className="size-6 animate-spin text-secondary/50" aria-hidden="true" />
<span className="sr-only">Cargando cobros</span>
<span className="sr-only">{t('loading')}</span>
</div>
) : null}
@@ -85,7 +82,7 @@ export function PaymentsView() {
<div className="mt-8 space-y-3 rounded-xl bg-danger-soft px-4 py-3 text-sm text-danger">
<p>{errorMessage}</p>
<Button variant="outline" size="sm" onClick={retry}>
Reintentar
{t('common:actions.retry')}
</Button>
</div>
) : null}
@@ -95,9 +92,9 @@ export function PaymentsView() {
<span className="mx-auto flex size-14 items-center justify-center rounded-2xl bg-accent-soft text-accent-fg">
<Wallet className="size-7" aria-hidden="true" />
</span>
<p className="mt-4 text-base font-semibold text-primary">Todavía no hay cobros</p>
<p className="mt-4 text-base font-semibold text-primary">{t('empty.title')}</p>
<p className="mx-auto mt-1.5 max-w-[34ch] text-sm leading-relaxed text-secondary">
Entrá a un grupo, abrí la ficha y creá los links de cobro del período.
{t('empty.description')}
</p>
</div>
) : null}
@@ -124,10 +121,10 @@ export function PaymentsView() {
onClick={() => setPage(page - 1)}
>
<ChevronLeft className="size-4" />
Anteriores
{t('prev')}
</Button>
<p className="text-xs text-foreground/50">
Página {page} de {totalPages} · {total} cobros
{t('pageInfo', { page, pages: totalPages, count: total })}
</p>
<Button
variant="outline"
@@ -135,7 +132,7 @@ export function PaymentsView() {
disabled={page >= totalPages}
onClick={() => setPage(page + 1)}
>
Siguientes
{t('next')}
<ChevronRight className="size-4" />
</Button>
</div>
@@ -143,7 +140,7 @@ export function PaymentsView() {
{isFetching && page > 1 ? (
<p className="flex items-center justify-center gap-2 py-4 text-sm text-foreground/50">
<Loader2 className="size-4 animate-spin" />
Actualizando…
{t('updating')}
</p>
) : null}
</>

View File

@@ -2,6 +2,7 @@ import { useQuery } from '@tanstack/react-query'
import { ExternalLink, FileText, Loader2 } from 'lucide-react'
import { Sheet } from '../../components/ui'
import { getReceiptUrl } from '../../lib/api'
import { useTranslation } from 'react-i18next'
const INLINE_IMAGES = new Set(['image/jpeg', 'image/png', 'image/webp'])
@@ -9,6 +10,7 @@ type ReceiptViewerProps = { reportId: string | null; title: string; onClose: ()
/* The file is private: each open asks for a fresh signed URL (5 minutes). */
export function ReceiptViewer({ reportId, title, onClose }: ReceiptViewerProps) {
const { t } = useTranslation('payments')
const query = useQuery({
queryKey: ['receipt-url', reportId],
queryFn: () => getReceiptUrl(reportId as string),
@@ -18,21 +20,21 @@ export function ReceiptViewer({ reportId, title, onClose }: ReceiptViewerProps)
})
return (
<Sheet isOpen={reportId !== null} onClose={onClose} title="Comprobante" description={title}>
<Sheet isOpen={reportId !== null} onClose={onClose} title={t('reported.receipt')} description={title}>
{query.isPending ? (
<div className="flex justify-center py-10" role="status" aria-label="Cargando comprobante">
<div className="flex justify-center py-10" role="status" aria-label={t('reported.loadingReceipt')}>
<Loader2 className="size-6 animate-spin text-accent" aria-hidden="true" />
</div>
) : query.isError || !query.data ? (
<p role="alert" className="py-6 text-center text-sm text-danger-fg">
No pudimos abrir el comprobante.
{t('reported.receiptError')}
</p>
) : (
<div className="space-y-3">
{INLINE_IMAGES.has(query.data.mime) ? (
<img src={query.data.url} alt={`Comprobante: ${query.data.name}`} className="max-h-[60dvh] w-full rounded-xl object-contain" />
<img src={query.data.url} alt={t('reported.receiptAlt', { name: query.data.name })} className="max-h-[60dvh] w-full rounded-xl object-contain" />
) : query.data.mime === 'application/pdf' ? (
<iframe src={query.data.url} title={`Comprobante: ${query.data.name}`} className="h-[60dvh] w-full rounded-xl border border-border" />
<iframe src={query.data.url} title={t('reported.receiptAlt', { name: query.data.name })} className="h-[60dvh] w-full rounded-xl border border-border" />
) : (
<div className="flex items-center gap-3 rounded-xl bg-primary-soft p-4 text-sm text-primary">
<FileText className="size-6 shrink-0" aria-hidden="true" />
@@ -46,7 +48,7 @@ export function ReceiptViewer({ reportId, title, onClose }: ReceiptViewerProps)
className="flex min-h-11 items-center justify-center gap-2 rounded-xl border border-border text-sm font-medium text-primary hover:bg-primary-soft"
>
<ExternalLink className="size-4" aria-hidden="true" />
Abrir en otra pestaña
{t('reported.openTab')}
</a>
</div>
)}

View File

@@ -2,7 +2,10 @@ import { useEffect, useRef, useState } from 'react'
import type { ReportedPaymentDto } from '@gruperly/shared'
import { Check, ChevronRight, FileText, Loader2, X } from 'lucide-react'
import { Avatar, Button, Input, Label } from '../../components/ui'
import { i18n } from '../../i18n/instance'
import { useIntlLocale } from '../../i18n'
import { formatPrice } from '../../lib/format'
import { useTranslation } from 'react-i18next'
const UNDO_MS = 6000
@@ -20,12 +23,14 @@ type ReportedPaymentCardProps = {
function feeName(fee: ReportedPaymentDto['fees'][number]): string {
if (fee.description) return fee.description
const month = new Date(fee.dueDate).toLocaleDateString('es-AR', { month: 'long', timeZone: 'UTC' })
const month = new Date(fee.dueDate).toLocaleDateString(i18n.language, { month: 'long', timeZone: 'UTC' })
return month.charAt(0).toUpperCase() + month.slice(1)
}
export function ReportedPaymentCard({ report, onOpenReceipt, onConfirm, onReject, onUndo, onSettled }: ReportedPaymentCardProps) {
const [outcome, setOutcome] = useState<Outcome | null>(null)
const { t } = useTranslation(['payments', 'common'])
const locale = useIntlLocale()
const [rejecting, setRejecting] = useState(false)
const [reason, setReason] = useState('')
const [busy, setBusy] = useState(false)
@@ -53,7 +58,7 @@ export function ReportedPaymentCard({ report, onOpenReceipt, onConfirm, onReject
}
const amount = formatPrice(report.totalAmount, report.currency)
const reportedAt = new Date(report.createdAt).toLocaleString('es-AR', {
const reportedAt = new Date(report.createdAt).toLocaleString(locale, {
day: 'numeric',
month: 'short',
hour: '2-digit',
@@ -71,11 +76,14 @@ export function ReportedPaymentCard({ report, onOpenReceipt, onConfirm, onReject
<X className="size-5 shrink-0 text-danger-fg" aria-hidden="true" />
)}
<span className="truncate">
{outcome === 'confirmed' ? 'Confirmado' : 'Rechazado'}: {report.attendee.fullName} · {amount}
{t(outcome === 'confirmed' ? 'reported.confirmed' : 'reported.rejected', {
name: report.attendee.fullName,
amount,
})}
</span>
</p>
<Button variant="outline" className="h-11 shrink-0" onClick={() => void run(onUndo, null)} disabled={busy}>
Deshacer
{t('reported.undo')}
</Button>
</li>
)
@@ -109,7 +117,7 @@ export function ReportedPaymentCard({ report, onOpenReceipt, onConfirm, onReject
</span>
<span className="min-w-0 flex-1">
<span className="block text-sm font-medium text-primary">
{report.receipt.available ? 'Ver comprobante' : 'Comprobante eliminado'}
{report.receipt.available ? t('reported.viewReceipt') : t('reported.receiptDeleted')}
</span>
<span className="block truncate text-xs text-secondary">{report.fees.map(feeName).join(', ')}</span>
</span>
@@ -118,7 +126,7 @@ export function ReportedPaymentCard({ report, onOpenReceipt, onConfirm, onReject
{report.note ? (
<p className="mt-3 whitespace-pre-line break-words rounded-xl border border-border px-3 py-2 text-sm text-primary">
<span className="block text-xs font-medium text-secondary">Nota del alumno</span>
<span className="block text-xs font-medium text-secondary">{t('reported.studentNote')}</span>
{report.note}
</p>
) : null}
@@ -131,22 +139,22 @@ export function ReportedPaymentCard({ report, onOpenReceipt, onConfirm, onReject
void run(() => onReject(reason.trim() || null), 'rejected')
}}
>
<Label htmlFor={`reject-${report.id}`}>Motivo (opcional, lo ve el alumno)</Label>
<Label htmlFor={`reject-${report.id}`}>{t('reported.reason')}</Label>
<Input id={`reject-${report.id}`} autoFocus maxLength={300} value={reason} onChange={(event) => setReason(event.target.value)} className="h-11" />
<div className="flex gap-2">
<Button variant="ghost" className="h-11 flex-1" onClick={() => setRejecting(false)}>
Cancelar
{t('common:actions.cancel')}
</Button>
<Button type="submit" variant="outline" className="h-11 flex-1" disabled={busy}>
{busy ? <Loader2 className="size-4 animate-spin" aria-hidden="true" /> : null}
Rechazar pago
{t('reported.rejectPayment')}
</Button>
</div>
</form>
) : (
<div className="mt-3 flex gap-2">
<Button variant="outline" className="h-11 flex-1" onClick={() => setRejecting(true)} disabled={busy}>
Rechazar
{t('reported.reject')}
</Button>
<Button
// Light fill, `primary` text (the green on its soft tint misses 4.5:1);
@@ -156,13 +164,13 @@ export function ReportedPaymentCard({ report, onOpenReceipt, onConfirm, onReject
disabled={busy}
>
{busy ? <Loader2 className="size-4 animate-spin" aria-hidden="true" /> : <Check className="size-4 text-success" strokeWidth={3} aria-hidden="true" />}
Confirmar
{t('reported.confirm')}
</Button>
</div>
)}
{failed ? (
<p role="alert" className="mt-2 text-sm text-danger-fg">
No pudimos guardar el cambio. Probá de nuevo.
{t('reported.error')}
</p>
) : null}
</li>

View File

@@ -5,12 +5,14 @@ import { confirmReportedPayment, rejectReportedPayment, undoPaymentReview } from
import { ReceiptViewer } from './ReceiptViewer'
import { ReportedPaymentCard } from './ReportedPaymentCard'
import { REPORTED_PAYMENTS_KEY, useReportedPayments } from './reportedPayments'
import { useTranslation } from 'react-i18next'
/* "Pagos para verificar": receipts the students reported. Confirming marks the
fees as paid; a reviewed card stays a few seconds with "Deshacer" before it
leaves the list. */
export function ReportedPaymentsSection() {
const queryClient = useQueryClient()
const { t } = useTranslation('payments')
const { data } = useReportedPayments()
const [viewing, setViewing] = useState<ReportedPaymentDto | null>(null)
const reports = data?.data ?? []
@@ -26,7 +28,7 @@ export function ReportedPaymentsSection() {
return (
<section aria-labelledby="to-verify-title" className="mt-5 space-y-3">
<h2 id="to-verify-title" className="flex items-center gap-2 text-base font-bold text-primary">
Pagos para verificar
{t('reported.title')}
<span className="rounded-full bg-accent px-2 py-0.5 text-xs font-semibold text-on-accent">{reports.length}</span>
</h2>
<ul className="space-y-3">

View File

@@ -1,5 +1,6 @@
import type { PaymentDto } from '@gruperly/shared'
import type { BadgeVariant } from '../../components/ui'
import { i18n } from '../../i18n/instance'
export const PAYMENT_STATUS_BADGE: Record<PaymentDto['status'], BadgeVariant> = {
PENDING: 'neutral',
@@ -14,9 +15,9 @@ export function paymentPeriodLabel(payment: PaymentDto): string {
export function paymentDateLabel(payment: PaymentDto): string {
if (payment.status === 'PAID' && payment.paidAt) {
return `Cobrada el ${formatDay(payment.paidAt)}`
return i18n.t('payments:row.paidOn', { date: formatDay(payment.paidAt) })
}
return `Vence el ${formatDay(payment.dueDate)}`
return i18n.t('payments:row.dueOn', { date: formatDay(payment.dueDate) })
}
/* Fechas sin hora: el vencimiento es un día, no un instante. */
@@ -24,7 +25,7 @@ function formatDay(iso: string): string {
const date = new Date(iso)
const today = new Date()
const sameYear = date.getFullYear() === today.getFullYear()
return date.toLocaleDateString('es-MX', {
return date.toLocaleDateString(i18n.language, {
day: 'numeric',
month: 'short',
...(sameYear ? {} : { year: 'numeric' }),