From bc866de55df03fe00d00a401cd6fc7df2008944f Mon Sep 17 00:00:00 2001 From: g-but <41178744+g-but@users.noreply.github.com> Date: Sun, 26 Apr 2026 11:05:47 +0200 Subject: [PATCH] fix(i18n): locale-preserving navigation across marketing nav & auth flow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 ( 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) --- app/[locale]/(auth)/login/page.tsx | 5 +++-- app/[locale]/(auth)/register/page.tsx | 5 +++-- app/[locale]/(auth)/reset-password/page.tsx | 5 +++-- components/sections/Nav.tsx | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/app/[locale]/(auth)/login/page.tsx b/app/[locale]/(auth)/login/page.tsx index 755db05..968bb60 100644 --- a/app/[locale]/(auth)/login/page.tsx +++ b/app/[locale]/(auth)/login/page.tsx @@ -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"; diff --git a/app/[locale]/(auth)/register/page.tsx b/app/[locale]/(auth)/register/page.tsx index bb7538c..8ec776a 100644 --- a/app/[locale]/(auth)/register/page.tsx +++ b/app/[locale]/(auth)/register/page.tsx @@ -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"; diff --git a/app/[locale]/(auth)/reset-password/page.tsx b/app/[locale]/(auth)/reset-password/page.tsx index 6deb09d..998773e 100644 --- a/app/[locale]/(auth)/reset-password/page.tsx +++ b/app/[locale]/(auth)/reset-password/page.tsx @@ -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"; diff --git a/components/sections/Nav.tsx b/components/sections/Nav.tsx index 6a8dc29..7dd5b6d 100644 --- a/components/sections/Nav.tsx +++ b/components/sections/Nav.tsx @@ -117,9 +117,9 @@ export default function Nav() { ) : ( <> - + {t("signIn")} - + {t("cta")}