refactor(auth): merge the duplicate login form and localize the auth screens
Gitea Actions Runner Test / test-job (push) Successful in 1s
CI / check (push) Successful in 1m8s
CI / tests-integration (push) Successful in 1m53s
CI / tests-unit (push) Successful in 1m59s
CI / tests-ui (push) Successful in 2m42s
CI / preflight (push) Skipped
CI / deploy (push) Successful in 4m33s
Gitea Actions Runner Test / test-job (push) Successful in 1s
CI / check (push) Successful in 1m8s
CI / tests-integration (push) Successful in 1m53s
CI / tests-unit (push) Successful in 1m59s
CI / tests-ui (push) Successful in 2m42s
CI / preflight (push) Skipped
CI / deploy (push) Successful in 4m33s
`home-login-form.tsx` and `login-form.tsx` were two ~240-line near-identical components. Delete the former and give `LoginForm` a `variant` prop: - `variant="page"` sr-only labels plus the register/forgot footer (/login) - `variant="compact"` visible labels, no footer (homepage sidebar) Field ids now come from `useId()`, so the two usages can never collide, and the hardcoded "Show"/"Hide"/"Loading" strings are translated. Localization of the login and register screens: - `home-login-form.tsx` was entirely hardcoded English. - `passwordStrength()` returned hardcoded "Weak"/"Fair"/"Good"/"Strong". - `register.ts` returned only English strings. It now returns a locale-independent `code` next to the message, and the form renders `t(code)` with the English string as a fallback. - Backfilled the new keys across all 25 locales, plus the login/register strings that were still English in most of them. `ar`, `fi` and `ja` had their entire login/register namespace in English and are now filled in. Locale parity stays at 0 missing keys, as `i18n:check` requires. Copy that did not match the enforced rules: the UI advertised "min 8 chars" (EN) / "min 6 tekens" (NL) while registration requires 12 characters plus an uppercase, a lowercase, a digit and a special character. Corrected in every locale. `password-reset.ts` enforced only 6 characters and is raised to 12 to match registration. Accessibility: `login-form.tsx` had no `<label>`, no `id` and no `required` on any field. All three are now present, and error banners are announced with `role="alert"`. Adds `src/i18n/auth-messages.test.ts`, which asserts every `RegisterErrorCode` resolves to a non-empty message in all 25 locales; verified it fails when a key is removed. The existing register tests now also assert the error `code`.
This commit is contained in:
1 parent
3d828a61ab
commit
6bffc53779
33 files changed
+1756
-842
No files matched your search
+47
-16
@@ -839,11 +839,15 @@
|
||||
"errorInvalid2fa": "Neplatný kód 2FA",
|
||||
"welcomeBack": "Vitaj späť",
|
||||
"welcomeBackSub": "Prihlás sa pre pokračovanie do {hotelName}",
|
||||
"errorUnverified": "Please verify your email before signing in.",
|
||||
"errorCaptcha": "Captcha verification failed. Please try again.",
|
||||
"whoIsOnline": "Who's online",
|
||||
"newestCitizens": "Newest citizens",
|
||||
"usersOnline": "{count} online"
|
||||
"errorUnverified": "Pred prihlásením overte svoju e-mailovú adresu.",
|
||||
"errorCaptcha": "Overenie captcha zlyhalo. Skúste to znova.",
|
||||
"whoIsOnline": "Kto je online",
|
||||
"newestCitizens": "Najnovší obyvatelia",
|
||||
"usersOnline": "{count} online",
|
||||
"username": "Používateľské meno",
|
||||
"password": "heslo",
|
||||
"showPassword": "Zobraziť",
|
||||
"hidePassword": "Skryť"
|
||||
},
|
||||
"register": {
|
||||
"title": "Vytvoriť účet",
|
||||
@@ -854,7 +858,7 @@
|
||||
"confirmPassword": "Zopakujte heslo",
|
||||
"usernamePlaceholder": "Používateľské meno",
|
||||
"emailPlaceholder": "Email",
|
||||
"passwordPlaceholder": "Heslo (min. 6 znakov)",
|
||||
"passwordPlaceholder": "Heslo (min. 12 znakov)",
|
||||
"confirmPasswordPlaceholder": "Zopakujte heslo",
|
||||
"selectOutfit": "Vyberte si oblečenie",
|
||||
"termsAccept": "Mám 18+ a súhlasím so zmluvnými podmienkami a pravidlami {hotel}.",
|
||||
@@ -866,7 +870,7 @@
|
||||
"termsError": "Ak sa chcete zaregistrovať, musíte prijať podmienky a pravidlá.",
|
||||
"usernameError": "Vyžaduje sa používateľské meno.",
|
||||
"emailError": "Vyžaduje sa platný e-mail.",
|
||||
"passwordError": "Heslo musí mať aspoň 6 znakov.",
|
||||
"passwordError": "Heslo musí mať aspoň 12 znakov",
|
||||
"confirmPasswordError": "Heslá sa nezhodujú.",
|
||||
"termsRequired": "Musíte prijať podmienky a pravidlá.",
|
||||
"usernameRequired": "Vyžaduje sa používateľské meno.",
|
||||
@@ -877,14 +881,39 @@
|
||||
"alreadyHaveAccountLink": "Prihlásiť sa",
|
||||
"whoIsOnline": "Kto je online",
|
||||
"usersOnline": "{count} online",
|
||||
"accepted": "Accepted & agreed",
|
||||
"showPassword": "Show",
|
||||
"hidePassword": "Hide",
|
||||
"accountDetails": "Account details",
|
||||
"credentials": "Credentials & security",
|
||||
"newestCitizens": "Newest citizens",
|
||||
"accepted": "Prijaté a súhlasím",
|
||||
"showPassword": "Zobraziť",
|
||||
"hidePassword": "Skryť",
|
||||
"accountDetails": "Údaje o účte",
|
||||
"credentials": "Prihlasovacie údaje a zabezpečenie",
|
||||
"newestCitizens": "Najnovší obyvatelia",
|
||||
"ageVerified": "Mám 18+ a súhlasím s vekovým požiadavkou.",
|
||||
"invitedBy": "Pozvaný používateľom {username}"
|
||||
"invitedBy": "Pozvaný používateľom {username}",
|
||||
"strengthWeak": "Slabé",
|
||||
"strengthFair": "Priemerné",
|
||||
"strengthGood": "Dobré",
|
||||
"strengthStrong": "Silné",
|
||||
"passwordMinLength": "Heslo musí mať aspoň 12 znakov",
|
||||
"passwordUpper": "Heslo musí obsahovať aspoň jedno veľké písmeno",
|
||||
"passwordLower": "Heslo musí obsahovať aspoň jedno malé písmeno",
|
||||
"passwordDigit": "Heslo musí obsahovať aspoň jednu číslicu",
|
||||
"passwordSpecial": "Heslo musí obsahovať aspoň jeden špeciálny znak",
|
||||
"passwordMaxLength": "Heslo je príliš dlhé",
|
||||
"usernameMinLength": "Používateľské meno musí mať aspoň 3 znaky",
|
||||
"usernameMaxLength": "Používateľské meno môže mať najviac 25 znakov",
|
||||
"usernamePattern": "Používateľské meno môže obsahovať iba písmená, číslice, podčiarknutie a pomlčku",
|
||||
"usernameReserved": "Toto používateľské meno je rezervované",
|
||||
"emailValid": "Zadajte platnú e-mailovú adresu",
|
||||
"emailDisposable": "Dočasné e-mailové domény nie sú povolené",
|
||||
"passwordsMatch": "Heslá sa nezhodujú.",
|
||||
"captchaFailed": "Overenie captcha zlyhalo. Skúste to znova.",
|
||||
"usernameTaken": "Toto používateľské meno je už obsadené",
|
||||
"rateLimited": "Príliš veľa pokusov o registráciu. Počkajte niekoľko minút a skúste to znova.",
|
||||
"vpnBlocked": "Registrácia cez pripojenia VPN/proxy nie je povolená.",
|
||||
"maxAccountsPerIp": "Dosiahli ste maximálny počet účtov pre vaše pripojenie.",
|
||||
"unavailable": "Registrácia je dočasne nedostupná.",
|
||||
"createFailed": "Účet sa nepodarilo vytvoriť. Skúste to znova alebo kontaktujte personál.",
|
||||
"invalidInput": "Skontrolujte označené políčka a skúste to znova."
|
||||
},
|
||||
"forgot": {
|
||||
"title": "Obnoviť heslo",
|
||||
@@ -898,9 +927,11 @@
|
||||
"reset": {
|
||||
"title": "Nastavte si nové heslo",
|
||||
"subtitle": "Zvoľte si silné heslo, ktoré inde nepoužívate.",
|
||||
"passwordPlaceholder": "Nové heslo (min. 6 znakov)",
|
||||
"passwordPlaceholder": "Nové heslo (min. 12 znakov)",
|
||||
"resetPassword": "Obnoviť heslo",
|
||||
"backToLogin": "Späť na prihlásenie"
|
||||
"backToLogin": "Späť na prihlásenie",
|
||||
"passwordMinLength": "Heslo musí mať aspoň 12 znakov",
|
||||
"tooManyAttempts": "Príliš veľa pokusov — skúste to neskôr"
|
||||
},
|
||||
"verify": {
|
||||
"verifiedTitle": "Všetko je pripravené",
|
||||
|
||||
Reference in new issue
Block a user