fix(i18n): locale-preserving navigation across marketing nav & auth flow

Same class of bug as the prior ResultsScreen fix, three more places:

  1. components/sections/Nav.tsx — the marketing "Sign in" link used
     NextLink (raw next/link) so /de/ → /login (English) instead of
     /de/login. Switched to the locale-aware Link (next-intl).

  2 & 3. app/[locale]/(auth)/login & register — both pages imported
     useRouter from next/navigation (raw) but useSearchParams + Link
     from next/navigation + @/lib/i18n/navigation respectively. Inside
     /de/login, router.push(`${AUTH_ROUTES.login}?returnTo=...`)
     pushed to /login (English) on the post-register sign-in nudge.
     Switched useRouter to @/lib/i18n/navigation so it stays inside
     /de/.

  4. app/[locale]/(auth)/reset-password — same useRouter swap so the
     post-reset push to /login keeps the visitor on /de/login.

Together with c8a430d (auth-page footer tagline), 1519877 (per-locale
title/description), c6dff54 (per-locale OG image), 5d77d3a (<html lang>
from URL not cookie) and the ResultsScreen fix, the marketing-site
visitor's chosen locale now survives every step from /de/ through to
account creation without dropping into English.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
g-butandClaude Opus 4.7 committed 2026-04-26 11:05:47 +02:00
1 parent e3edf4a4f2
commit bc866de55d
4 files changed
+11 -8

No files matched your search

+3 -2
View File
@@ -2,9 +2,10 @@
import { Suspense, useState } from "react";
import { signIn } from "next-auth/react";
import { useRouter, useSearchParams } from "next/navigation";
import { useSearchParams } from "next/navigation";
import { useTranslations } from "next-intl";
import { Link } from "@/lib/i18n/navigation";
// Locale-aware router & Link so /de/login → /de/register (not /register)
import { Link, useRouter } from "@/lib/i18n/navigation";
import styles from "../auth.module.css";
import { AUTH_ROUTES, PORTAL_ROUTES } from "@/lib/config/routes";
import { sanitizeReturnTo } from "@/lib/domain/auth";
+3 -2
View File
@@ -2,9 +2,10 @@
import { Suspense, useState, useEffect } from "react";
import { signIn } from "next-auth/react";
import { useRouter, useSearchParams } from "next/navigation";
import { useSearchParams } from "next/navigation";
import { useTranslations } from "next-intl";
import { Link } from "@/lib/i18n/navigation";
// Locale-aware router & Link so /de/register → /de/login (not /register)
import { Link, useRouter } from "@/lib/i18n/navigation";
import styles from "../auth.module.css";
import { AUTH_ROUTES, PORTAL_ROUTES } from "@/lib/config/routes";
import { sanitizeReturnTo } from "@/lib/domain/auth";
+3 -2
View File
@@ -1,9 +1,10 @@
"use client";
import { Suspense, useState } from "react";
import { useRouter, useSearchParams } from "next/navigation";
import { useSearchParams } from "next/navigation";
import { useTranslations } from "next-intl";
import { Link } from "@/lib/i18n/navigation";
// Locale-aware router so post-reset push to /login keeps the visitor on /de/login
import { Link, useRouter } from "@/lib/i18n/navigation";
import styles from "../auth.module.css";
import { PASSWORD_MIN_LENGTH } from "@/lib/config/auth";
import { AUTH_ROUTES } from "@/lib/config/routes";
+2 -2
View File
@@ -117,9 +117,9 @@ export default function Nav() {
</NextLink>
) : (
<>
<NextLink href={AUTH_ROUTES.login} className={styles.navSignIn}>
<Link href={AUTH_ROUTES.login} className={styles.navSignIn}>
{t("signIn")}
</NextLink>
</Link>
<a href="?assessment=open" className={styles.navBtn}>
{t("cta")}
</a>