i18n: títulos de pestaña por idioma (metadata -> generateMetadata)
Los <title> estáticos estaban en español fijo. Se migran 31 páginas a generateMetadata reutilizando la clave de título ya traducida de cada página (o del <h1>). Se traducen además los PageShell title hardcodeados de las 6 páginas CharServiceB y los títulos de download-client y changelogs (+ su mensaje de error). tsc/build OK, paridad es/en, <title> cambia por idioma. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
import type { Metadata } from 'next'
|
||||
import { setRequestLocale } from 'next-intl/server'
|
||||
import { setRequestLocale, getTranslations } from 'next-intl/server'
|
||||
import { getCommits } from '@/lib/changelog'
|
||||
import { Pagination } from '@/components/Pagination'
|
||||
|
||||
export const metadata: Metadata = { title: 'Changelogs' }
|
||||
export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }): Promise<Metadata> {
|
||||
const { locale } = await params
|
||||
const t = await getTranslations({ locale, namespace: 'Misc' })
|
||||
return { title: t('changelogs.title') }
|
||||
}
|
||||
|
||||
function formatFecha(iso: string): string {
|
||||
if (!iso) return ''
|
||||
@@ -29,6 +33,7 @@ export default async function ChangelogsPage({
|
||||
const sp = await searchParams
|
||||
const page = Math.max(1, Number(sp.page) || 1)
|
||||
setRequestLocale(locale)
|
||||
const t = await getTranslations('Misc')
|
||||
const { commits, totalPages } = await getCommits(page, 5)
|
||||
|
||||
return (
|
||||
@@ -36,12 +41,12 @@ export default async function ChangelogsPage({
|
||||
<div className="middle-content">
|
||||
<div className="body-content">
|
||||
<div className="title-content">
|
||||
<h1>Changelogs</h1>
|
||||
<h1>{t('changelogs.title')}</h1>
|
||||
</div>
|
||||
<div className="box-content">
|
||||
<div className="body-box-content">
|
||||
{commits.length === 0 ? (
|
||||
<p className="centered">No se pudieron cargar los cambios en este momento.</p>
|
||||
<p className="centered">{t('changelogs.loadError')}</p>
|
||||
) : (
|
||||
<>
|
||||
{commits.map((c) => (
|
||||
|
||||
Reference in New Issue
Block a user