From ed82d748ea458958889f69ee5d1bdbe63b62ba8b Mon Sep 17 00:00:00 2001 From: denkfabrik-li <274324701+denkfabrik-li@users.noreply.github.com> Date: Sat, 29 Aug 2026 02:03:26 +0200 Subject: [PATCH] Run the auth and settings screens through the translator use-translation.ts states the rule: every user-facing string in a component must go through t(). Five screens never called it at all -- forgot-password, reset-password, confirm-password, verify-email and settings/password had zero occurrences of useTranslation -- so a client who had chosen Spanish reset their password in English, from the browser tab down to the submit button. settings/profile had the hook but used it for two strings, leaving its heading, labels and the whole email-verification notice hardcoded around them. The password page also carried a second, smaller mistake the miss was hiding: its
title said "Profile settings", copied from the profile page, so the tab named the wrong screen in every language. It says "Password settings" now, the wording its own breadcrumb and the sibling "Notification settings" title already use. Every string on the six screens goes through t() now. The two module-level breadcrumb arrays moved inside their components to reach the hook -- the shape two-factor, notifications and the other settings pages already have. Where a key already exists in the catalogs (Email address, Password, Confirm password, New password, Log out and friends, shared with the login screen) the existing translations light up immediately; the keys new to the catalogs fall back to their English text, exactly what those lines rendered before, until the locales pick them up. TranslationUsageTest is the guard, a source scan like DateFormattingUsageTest and for the same reason: no JavaScript test runner gates this class of miss. It fails on any page under pages/auth or pages/settings that never uses the hook -- those screens always carry copy of their own, so a page there without it is a page somebody forgot -- and on any literal anywhere, which is both a user-facing string and where the copy-paste title above lived. Both scans go red on the tree without this change: five pages and six literal titles. --- resources/js/pages/auth/confirm-password.tsx | 15 ++-- resources/js/pages/auth/forgot-password.tsx | 14 ++-- resources/js/pages/auth/reset-password.tsx | 19 +++-- resources/js/pages/auth/verify-email.tsx | 12 +-- resources/js/pages/settings/password.tsx | 38 +++++---- resources/js/pages/settings/profile.tsx | 32 +++---- tests/Unit/TranslationUsageTest.php | 87 ++++++++++++++++++++ 7 files changed, 160 insertions(+), 57 deletions(-) create mode 100644 tests/Unit/TranslationUsageTest.php diff --git a/resources/js/pages/auth/confirm-password.tsx b/resources/js/pages/auth/confirm-password.tsx index 5b3e7dbe..355ea9f6 100644 --- a/resources/js/pages/auth/confirm-password.tsx +++ b/resources/js/pages/auth/confirm-password.tsx @@ -7,9 +7,12 @@ import InputError from '@/components/input-error'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; +import { useTranslation } from '@/hooks/use-translation'; import AuthLayout from '@/layouts/auth-layout'; export default function ConfirmPassword() { + const { t } = useTranslation(); + const { data, setData, post, processing, errors, reset } = useForm({ password: '', }); @@ -24,20 +27,20 @@ export default function ConfirmPassword() { return (