i18n con next-intl: raíz multilenguaje (es por defecto, /en) + textos externalizados
- next-intl 4 (compatible Next 16): routing (es default en RAÍZ sin prefijo, en con /en, localePrefix 'as-needed'), middleware, request config, navigation helpers. - Estructura app/[locale]/ (layout con <html lang>, NextIntlClientProvider, metadata SEO por idioma vía generateMetadata; page home con getTranslations). - Catálogos messages/es.json y en.json: TODOS los textos de la UI (nada hardcodeado en los .tsx, se usan con t()). Verificado: / -> español (lang=es, título ES), /en -> inglés (lang=en, título EN), datos SSR desde MySQL. Añadir idioma = locale en routing + messages/<loc>.json. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import type { NextConfig } from "next";
|
||||
import type { NextConfig } from 'next'
|
||||
import createNextIntlPlugin from 'next-intl/plugin'
|
||||
|
||||
const withNextIntl = createNextIntlPlugin('./i18n/request.ts')
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
/* config options here */
|
||||
};
|
||||
}
|
||||
|
||||
export default nextConfig;
|
||||
export default withNextIntl(nextConfig)
|
||||
|
||||
Reference in New Issue
Block a user