Skip to content

feat: replace locale auto-redirect with a language suggestion banner - #366

Merged
fenbox merged 1 commit into
apache:mainfrom
fenbox:feat/language-suggestion-banner
Nov 26, 2026
Merged

fenbox merged 1 commit into
apache:mainfrom
fenbox:feat/language-suggestion-banner

Conversation

@fenbox

@fenbox fenbox commented Nov 26, 2026

Copy link
Copy Markdown
Member

What this PR does

Language suggestion banner

Previously, visitors whose browser language matched Chinese were automatically redirected to the Chinese version of the site. This PR replaces that behavior with a dismissible suggestion banner at the top of the page:

  • Shows an Infima alert alert--secondary banner only when the browser language is Chinese and the current page is the English site
  • The banner offers a "切换" link to the corresponding /zh-CN/ path (preserving query and hash)
  • A close button (the theme's built-in AnnouncementBar/CloseButton) dismisses it for the session via sessionStorage
  • No automatic redirects anymore

Navbar locale dropdown

The locale dropdown previously rendered the full locale label ("English" / "简体中文") in the navbar, taking significant horizontal space. It is now an icon-only trigger with an aria-label for accessibility; the dropdown menu still shows full language names.

Dependency cleanup

Removes unused dependencies: @docusaurus/theme-mermaid, @docusaurus/theme-search-algolia, hast-util-is-element, mixpanel-browser, sass-loader.

Misc

  • Adds AGENTS.md with repository guidelines for AI coding agents

Validation

  • Verified in dev server with a Chinese-locale browser (ego lite / CDP locale override): banner appears on English pages, hidden on /zh-CN/ pages
  • Switch link navigates to the correct /zh-CN/ path; close button dismisses and persists for the session
  • Banner renders at the very top, scrolls away naturally, does not overlap the sticky navbar
  • docusaurus build --locale en succeeds (existing broken-anchor warnings unchanged)

Copilot AI balanced review requested due to automatic review settings November 26, 2026 03:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@fenbox
fenbox force-pushed the feat/language-suggestion-banner branch from 4523b1f to b9483e6 Compare November 26, 2026 04:28
- Show a dismissible top banner when the browser language is Simplified
  Chinese on the English site, instead of redirecting automatically
- Remember an explicit language choice in localStorage and go straight
  to the chosen locale on return visits
- Compact the navbar locale dropdown to an icon-only trigger
- Remove unused dependencies
- Add AGENTS.md contributor guidelines
@fenbox
fenbox force-pushed the feat/language-suggestion-banner branch from b9483e6 to 9bcf9bf Compare November 26, 2026 04:44
@fenbox
fenbox merged commit cdcb297 into apache:main Nov 26, 2026
1 check passed
@fenbox
fenbox deleted the feat/language-suggestion-banner branch November 26, 2026 06:37
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.

2 participants