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,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' }),