Skip to content

feat(web): enable app locales and add language toggle#1356

Merged
cungminh2710 merged 2 commits into
mainfrom
cursor/app-locale-support-and-selector
Jul 10, 2026
Merged

feat(web): enable app locales and add language toggle#1356
cungminh2710 merged 2 commits into
mainfrom
cursor/app-locale-support-and-selector

Conversation

@cungminh2710

Copy link
Copy Markdown
Contributor

What changed

Promote ready content locales (zh-CN, vi-VN, de-DE, fr-FR) into SUPPORTED_APP_LOCALES so routing, cookies, sitemap, and robots cover them. Add a LocaleToggle beside ThemeToggle on the marketing navbar and in the app shell. Includes the approved ADR.

How to test

  • Open marketing or app shell and switch language via the new toggle; confirm URL prefix and UI locale update
  • Confirm /zh-CN/..., /vi-VN/..., /de-DE/..., /fr-FR/... routes resolve
  • Spot-check sitemap.xml and robots.txt include the new locales
  • From apps/hyperlocalise-web: vp test src/lib/app-i18n/ and vp check --fix

Checklist

  • I ran relevant checks locally (vp check --fix; locale-related vp test)
  • I updated docs, comments, or examples when needed
  • This PR is scoped and ready for review

Made with Cursor

cungminh2710 and others added 2 commits July 10, 2026 11:35
Co-authored-by: Cursor <cursoragent@cursor.com>
Promote ready content locales into routing and add a LocaleToggle beside ThemeToggle on marketing and in the app shell.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hyperlocalise Ignored Ignored Jul 10, 2026 1:40am

Request Review

@cungminh2710
cungminh2710 marked this pull request as ready for review July 10, 2026 01:41
@cungminh2710
cungminh2710 requested a review from MuenYu as a code owner July 10, 2026 01:41
@cursor

cursor Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@greptile-apps

greptile-apps Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR enables more app locales and adds a language switcher. The main changes are:

  • Promotes ready content locales into supported app locales.
  • Adds a LocaleToggle to marketing and app-shell navigation.
  • Adds locale path rewrite helpers and tests.
  • Documents the locale support and selector design in an ADR.

Confidence Score: 5/5

This looks safe to merge after a small locale-toggle cleanup.

  • The expanded locale list follows the existing routing and provider patterns.
  • The new switcher has one small state-source mismatch that can produce an incorrect URL in fast navigation cases.
  • No blocking issues were found in the changed code.

apps/hyperlocalise-web/src/components/locale-toggle/locale-toggle.tsx

Important Files Changed

Filename Overview
apps/hyperlocalise-web/src/components/locale-toggle/locale-toggle.tsx Adds the client language dropdown and locale-switch navigation.
apps/hyperlocalise-web/src/lib/app-i18n/rewrite-app-locale-path.ts Adds helpers for reading and rewriting app locale prefixes.
apps/hyperlocalise-web/src/lib/app-i18n/locales.ts Expands supported app locales to match available content locales.
apps/hyperlocalise-web/src/app/[lang]/(marketing)/_components/navbar.tsx Adds the language toggle next to the existing theme controls.
apps/hyperlocalise-web/src/components/app-shell/app-shell-client.tsx Adds the language toggle to the authenticated app shell header.

Fix All in Codex

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
apps/hyperlocalise-web/src/components/locale-toggle/locale-toggle.tsx:65
**Mixed Router And Window State**

When the user changes language during or immediately after a client-side navigation, `pathname` can come from the App Router state while `window.location.search` and `window.location.hash` still come from the current browser URL. That can combine the next route with stale query or hash state, so the language toggle can navigate to the wrong localized URL or preserve filters/anchors from the previous page.

Reviews (1): Last reviewed commit: "feat(web): enable app locales and add la..." | Re-trigger Greptile


const search = typeof window !== "undefined" ? window.location.search : "";
const hash = typeof window !== "undefined" ? window.location.hash : "";
router.push(rewriteAppLocalePath(`${pathname}${search}${hash}`, nextLocale));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Mixed Router And Window State

When the user changes language during or immediately after a client-side navigation, pathname can come from the App Router state while window.location.search and window.location.hash still come from the current browser URL. That can combine the next route with stale query or hash state, so the language toggle can navigate to the wrong localized URL or preserve filters/anchors from the previous page.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/hyperlocalise-web/src/components/locale-toggle/locale-toggle.tsx
Line: 65

Comment:
**Mixed Router And Window State**

When the user changes language during or immediately after a client-side navigation, `pathname` can come from the App Router state while `window.location.search` and `window.location.hash` still come from the current browser URL. That can combine the next route with stale query or hash state, so the language toggle can navigate to the wrong localized URL or preserve filters/anchors from the previous page.

How can I resolve this? If you propose a fix, please make it concise.

Fix in Codex

@cungminh2710
cungminh2710 merged commit 9808169 into main Jul 10, 2026
13 checks passed
@cungminh2710
cungminh2710 deleted the cursor/app-locale-support-and-selector branch July 10, 2026 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant