Skip to content

feat: language dropdown on the landing page and docs - #100

Merged
sapatmohit merged 1 commit into
mainfrom
feat/language-switcher
Nov 1, 2026
Merged

sapatmohit merged 1 commit into
mainfrom
feat/language-switcher

Conversation

@sapatmohit

Copy link
Copy Markdown
Member

Part of #96. Until now the language could only be changed by editing the URL.

What

  • `SiteLanguageSwitcher` (`src/components/site-language-switcher.tsx`) is built on our own `LanguageSwitcher` from the registry. It shows native names (English, Español, 日本語, العربية).
  • Picking a language:
    • saves it in `NEXT_LOCALE`;
    • reloads the same page under that language's prefix: `/docs/x` → `/ja/docs/x`, `/es` → `/` for English.
  • It's a full page load rather than `router.push`: the root layout's `` and the next-intl messages only re-render on a document request.
  • Placement:
    • landing navbar, next to the GitHub counter on desktop, and in the mobile menu;
    • docs sidebar footer, where Fumadocs normally puts its language toggle (docs pages have no top navbar on desktop).
  • The aria labels ("Select language", "Current language: …") are translated in all four locale files.

Verified

In headless Chromium against `next start`:

  • Landing: picking 日本語 goes to `/ja`, with `lang="ja"` and `NEXT_LOCALE=ja`.
  • Docs: picking العربية on `/ja/docs/getting-started/install` goes to `/ar/docs/getting-started/install`, with `lang="ar" dir="rtl"` and the sidebar mirrored.
  • Mobile (390 px): the menu shows the dropdown.

Lint, `format:check`, typecheck, tests (+3 for the path helper), `build`, `build:lib` and `test:pack` all pass.

Visitors could only change language by editing the URL. The landing
navbar (desktop and mobile menu) and the docs sidebar now have a language
dropdown built on our own LanguageSwitcher. Picking a language saves it in
NEXT_LOCALE and reloads the same page under that language's prefix
(/docs/x -> /ja/docs/x; English has none). It's a full page load, so the
root layout's lang/dir and messages switch with it.
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a9931a0b-00c8-4596-a141-3c9499362234
Commits

Reviewing files that changed from the base of the PR and between 8c45f23 and c2710d6.

Files selected for processing: 8
  • public/locales/ar.json
  • public/locales/en.json
  • public/locales/es.json
  • public/locales/ja.json
  • src/app/docs/layout.tsx
  • src/components/landing/navbar.tsx
  • src/components/site-language-switcher.tsx
  • test/site-language-switcher.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@sapatmohit
sapatmohit merged commit 0c63374 into main Nov 1, 2026
2 checks passed
@sapatmohit
sapatmohit deleted the feat/language-switcher branch November 1, 2026 20:02
sapatmohit added a commit that referenced this pull request Nov 1, 2026
The labels added in #100 weren't in .babelize/local/babelize-lock.json, so
the next babelize run would have re-translated them; they're recorded as
manual now. Locale keys are sorted the way Babelize writes them, so a
babelize translate dry run changes nothing.
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