Skip to content

Server renders Chinese translations when NEXT_LOCALE=zh cookie persists #378

Description

@npagare

Description

When a user clicks the language toggle to switch languages, the NEXT_LOCALE cookie is set with the corresponding locale. Subsequent page loads respect this cookie and serve the correct translations for that locale. However, there are two issues:

Issue 1: <html lang> attribute mismatch

The server always renders <html lang="en"> in the HTML, regardless of which locale is actually being served. When NEXT_LOCALE=zh, the page content is in Chinese but the lang attribute stays en.

Issue 2: No way to reset locale (cookie persists)

Once NEXT_LOCALE is set (e.g., to zh), there is no visible UI to switch back. The language toggle is not available after login on all pages. The cookie persists across InPrivate sessions if the browser window stays open, and the only way to reset it is:

  • Manually delete the cookie via DevTools
  • Append ?lang=en to the URL
  • Close all InPrivate windows and open a fresh one

Steps to Reproduce

  1. Visit http://localhost:3300/admin/repositories
  2. If NEXT_LOCALE=zh cookie is set, observe Chinese translations in embedded JSON data
  3. Check <html lang> — it always shows en regardless
  4. Try to find a UI control to switch back to English — none exists

Expected Behavior

  • <html lang> should match the actual locale being served
  • There should be a user-visible way to reset/change the locale cookie (language toggle should be accessible on admin pages)

Screenshot

(Screenshot showing Chinese translations with <html lang="en"> — attach manually via web UI)

Image Image

Environment

  • OpenDeepWiki (latest upstream HEAD)
  • Docker Desktop deployment
  • Browser: Opera (reproducible in InPrivate mode)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions