fix(i18n): render locale switch as links

Use locale-prefixed <Link> elements for EN/DE so language switching works even when client-side hydration is broken.

Co-authored-by: dennis <dennis@konkol.net>
This commit is contained in:
Cursor Agent
2026-01-14 16:29:55 +00:00
parent 411806d5ce
commit f2b3f1edfd
2 changed files with 17 additions and 31 deletions

View File

@@ -4,15 +4,15 @@ test.describe("i18n routing", () => {
test("language switcher navigates between locales", async ({ page }) => {
await page.goto("/en", { waitUntil: "domcontentloaded" });
// Buttons have aria-labels; click the DE switcher.
const deButton = page.getByRole("button", { name: "Sprache auf Deutsch umstellen" });
if (await deButton.count()) {
// Locale switchers are links (work even without hydration)
const deLink = page.getByRole("link", { name: "Sprache auf Deutsch umstellen" });
if (await deLink.count()) {
// Verify an EN label is present before switching (nav.home)
await expect(page.getByRole("link", { name: "Home" })).toBeVisible();
await Promise.all([
page.waitForURL(/\/de(\/|$)/, { timeout: 30000 }),
deButton.click(),
deLink.click(),
]);
// Verify the nav label updates after switching