From da7b6b5bfa440d9c4ec76711f5c6e006845d64d6 Mon Sep 17 00:00:00 2001 From: Felipe Cardoso Date: Wed, 19 Nov 2025 03:02:59 +0100 Subject: [PATCH] Implement extensive localization improvements across forms and components - Refactored `it.json` translations with added keys for authentication, admin panel, and settings. - Updated authentication forms (`LoginForm`, `RegisterForm`, `PasswordResetConfirmForm`) to use localized strings via `next-intl`. - Enhanced password validation schemas with dynamic translations and refined error messages. - Adjusted `Header` and related components to include localized navigation and status elements. - Improved placeholder hints, button labels, and inline validation messages for seamless localization. --- frontend/src/components/auth/RegisterForm.tsx | 6 +----- frontend/tests/__mocks__/next-intl.tsx | 4 +++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/auth/RegisterForm.tsx b/frontend/src/components/auth/RegisterForm.tsx index f67ae5a..d8a433e 100644 --- a/frontend/src/components/auth/RegisterForm.tsx +++ b/frontend/src/components/auth/RegisterForm.tsx @@ -33,11 +33,7 @@ const createRegisterSchema = (t: (key: string) => string) => .min(1, t('firstNameRequired')) .min(2, t('firstNameMinLength')) .max(50, t('firstNameMaxLength')), - last_name: z - .string() - .max(50, t('lastNameMaxLength')) - .optional() - .or(z.literal('')), // Allow empty string + last_name: z.string().max(50, t('lastNameMaxLength')).optional().or(z.literal('')), // Allow empty string password: z .string() .min(1, t('passwordRequired')) diff --git a/frontend/tests/__mocks__/next-intl.tsx b/frontend/tests/__mocks__/next-intl.tsx index 10c3f17..a969557 100644 --- a/frontend/tests/__mocks__/next-intl.tsx +++ b/frontend/tests/__mocks__/next-intl.tsx @@ -4,7 +4,9 @@ export const useLocale = jest.fn(() => 'en'); export const useTranslations = jest.fn(() => (key: string) => key); -export const NextIntlClientProvider = ({ children }: { children: React.ReactNode }) => <>{children}; +export const NextIntlClientProvider = ({ children }: { children: React.ReactNode }) => ( + <>{children} +); export const useFormatter = jest.fn(() => ({})); export const useMessages = jest.fn(() => ({})); export const useNow = jest.fn(() => new Date());