i18n: traducir toda la app (ES + EN) — páginas y componentes con texto hardcodeado

Se externaliza el texto español hardcodeado de ~55 archivos a next-intl y se añaden
traducciones al inglés, con paridad de claves es/en. Nuevos namespaces: History,
CharService, CharServiceB, Points, Legal, UI, Misc (+ altas en Common/Admin).

- Historiales (PD/PV, transacciones, sanciones, seguridad), servicios de personaje
  (transfer, send-gift, quest, restore-*, change-*, customize, level-up, gold, rename),
  PD/pagos (d-points, trade, promo, transfer-dp, rename-guild, DPointsTabs), páginas
  legales (cookies, privacidad, términos, reembolsos, aviso legal, contacto), layout
  (cabecera, footer, cookies, 2FA, descargas, jugadores, recluta) y páginas varias
  (home, reino, ayuda, addons, 2falogin).
- Textos con markup inline via t.rich; interpolación con ICU.
- Componente <NoteLegend/> para la leyenda NOTA/NOTE compartida.
- payLabel/confirmText de los servicios de pago traducidos.
- Verificado: tsc OK, next build OK, todas las claves t() resuelven en es y en,
  todos los t.rich casan etiquetas, páginas 200 en /es/ y /en/ sin claves crudas.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-14 18:58:54 +00:00
parent e457a43f05
commit 651d8deafc
57 changed files with 3516 additions and 1190 deletions
+23 -21
View File
@@ -1,6 +1,7 @@
'use client'
import { useMemo, useState } from 'react'
import { useTranslations } from 'next-intl'
import type { GiftCategory, GiftItem } from '@/lib/gift'
import { CharacterSelect, type CharOption } from '@/components/CharacterSelect'
@@ -53,6 +54,7 @@ export function SendGiftForm({
catalog: GiftCategory[]
currency?: string
}) {
const t = useTranslations('CharService')
const [source, setSource] = useState('')
const [destination, setDestination] = useState('')
const [token, setToken] = useState('')
@@ -106,16 +108,16 @@ export function SendGiftForm({
e.preventDefault()
if (busy) return
if (!source || !destination.trim() || !token.trim()) {
setError('Completa el personaje de origen, el de destino y el token de seguridad.')
setError(t('sendGift.errMissingFields'))
return
}
if (cart.size === 0) {
setError('Añade al menos un objeto al carrito.')
setError(t('sendGift.errEmptyCart'))
return
}
if (
!window.confirm(
`¿Enviar el regalo a "${destination.trim()}" por ${total} ${currency} (SumUp)? Esta acción no es reversible.`,
t('sendGift.confirm', { destination: destination.trim(), total, currency }),
)
)
return
@@ -137,40 +139,40 @@ export function SendGiftForm({
const data: { success?: boolean; url?: string; message?: string } = await res.json()
if (data.success && data.url) window.location.href = data.url
else {
setError(data.message || 'No se pudo iniciar el pago. Inténtalo de nuevo.')
setError(data.message || t('sendGift.errPayment'))
setBusy(false)
}
} catch {
setError('Algo ha salido mal. Inténtalo más tarde.')
setError(t('sendGift.errUnexpected'))
setBusy(false)
}
}
if (characters.length === 0) return <p className="second-brown">No tienes personajes disponibles.</p>
if (catalog.length === 0) return <p className="second-brown">No hay objetos disponibles para regalar por ahora.</p>
if (characters.length === 0) return <p className="second-brown">{t('sendGift.noCharacters')}</p>
if (catalog.length === 0) return <p className="second-brown">{t('sendGift.noItems')}</p>
return (
<div className="centered">
<form onSubmit={handleSubmit} acceptCharset="utf-8">
<p>Escoge desde qué personaje se envía el regalo:</p>
<CharacterSelect characters={characters} value={source} onChange={setSource} placeholder="Personaje de origen" />
<p>{t('sendGift.sourcePrompt')}</p>
<CharacterSelect characters={characters} value={source} onChange={setSource} placeholder={t('sendGift.sourcePlaceholder')} />
<br />
<p>Nombre del personaje que recibirá el regalo:</p>
<p>{t('sendGift.destPrompt')}</p>
<input
type="text"
maxLength={12}
placeholder="Personaje de destino"
placeholder={t('sendGift.destPlaceholder')}
value={destination}
onChange={(e) => setDestination(e.target.value)}
required
/>
<br />
<p>Token de seguridad:</p>
<SecretInput value={token} onChange={setToken} placeholder="Token de seguridad" />
<p>{t('sendGift.tokenPrompt')}</p>
<SecretInput value={token} onChange={setToken} placeholder={t('sendGift.tokenPlaceholder')} />
<hr />
{/* Catálogo de objetos: cuadrícula centrada de 4 por fila + paginación */}
<h3 className="first-brown centered">Objetos disponibles</h3>
<h3 className="first-brown centered">{t('sendGift.availableItems')}</h3>
<div className="gift-grid">
{pageItems.map((it) => (
<div className="item-box" key={it.id}>
@@ -183,7 +185,7 @@ export function SendGiftForm({
{it.price} {currency}
</div>
<button type="button" className="store-add-button" onClick={() => addItem(it)}>
Añadir
{t('sendGift.add')}
</button>
</div>
))}
@@ -191,7 +193,7 @@ export function SendGiftForm({
{totalPages > 1 && (
<div className="gift-pagination">
<button type="button" onClick={() => setPage((p) => Math.max(1, Math.min(totalPages, p) - 1))} disabled={currentPage === 1}>
Atrás
{t('sendGift.back')}
</button>
{Array.from({ length: totalPages }, (_, i) => i + 1).map((n) => (
<button
@@ -204,16 +206,16 @@ export function SendGiftForm({
</button>
))}
<button type="button" onClick={() => setPage((p) => Math.min(totalPages, Math.min(totalPages, p) + 1))} disabled={currentPage === totalPages}>
Siguiente
{t('sendGift.next')}
</button>
</div>
)}
<hr />
{/* Carrito */}
<h3 className="first-brown">Carrito</h3>
<h3 className="first-brown">{t('sendGift.cart')}</h3>
{cart.size === 0 ? (
<p className="second-brown">Aún no has añadido objetos.</p>
<p className="second-brown">{t('sendGift.cartEmpty')}</p>
) : (
<table className="cart-list max-center-table">
<tbody>
@@ -248,7 +250,7 @@ export function SendGiftForm({
<div className="centered">
<br />
<p>
Total: <span className="yellow-info">{total} {currency}</span> (SumUp)
{t.rich('sendGift.total', { total, currency, s: (c) => <span className="yellow-info">{c}</span> })}
</p>
<br />
<button
@@ -256,7 +258,7 @@ export function SendGiftForm({
className="store-send-button"
disabled={busy || cart.size === 0 || !source || !destination.trim() || !token.trim()}
>
{busy ? 'Enviando regalo' : 'ENVIAR REGALO'}
{busy ? t('sendGift.submitting') : t('sendGift.submit')}
</button>
</div>
</form>