Refactor i18n integration and update tests for improved localization

- Updated test components (`PasswordResetConfirmForm`, `PasswordChangeForm`) to use i18n keys directly, ensuring accurate validation messages.
- Refined translations in `it.json` to standardize format and content.
- Replaced text-based labels with localized strings in `PasswordResetRequestForm` and `RegisterForm`.
- Introduced `generateLocalizedMetadata` utility and updated layout metadata generation for locale-aware SEO.
- Enhanced e2e tests with locale-prefixed routes and updated assertions for consistency.
- Added comprehensive i18n documentation (`I18N.md`) for usage, architecture, and testing.
This commit is contained in:
Felipe Cardoso
2025-11-19 14:07:13 +01:00
parent da7b6b5bfa
commit 7b1bea2966
29 changed files with 1263 additions and 105 deletions

View File

@@ -4,6 +4,7 @@ import { notFound } from 'next/navigation';
import { routing } from '@/lib/i18n/routing';
import { NextIntlClientProvider } from 'next-intl';
import { getMessages } from 'next-intl/server';
import { generateLocalizedMetadata, type Locale } from '@/lib/i18n/metadata';
import '../globals.css';
import { Providers } from '../providers';
import { AuthProvider } from '@/lib/auth/AuthContext';
@@ -23,10 +24,14 @@ const geistMono = Geist_Mono({
preload: false, // Only preload primary font
});
export const metadata: Metadata = {
title: 'FastNext Template',
description: 'FastAPI + Next.js Template',
};
export async function generateMetadata({
params,
}: {
params: Promise<{ locale: string }>;
}): Promise<Metadata> {
const { locale } = await params;
return generateLocalizedMetadata(locale as Locale);
}
export default async function LocaleLayout({
children,