Skip to content

docs: fix router auto language redirect#2378

Merged
RealKai42 merged 1 commit into
mainfrom
kaiyi/fix-doc
May 27, 2026
Merged

docs: fix router auto language redirect#2378
RealKai42 merged 1 commit into
mainfrom
kaiyi/fix-doc

Conversation

@RealKai42
Copy link
Copy Markdown
Collaborator

Summary

  • Fix landing page auto-redirect by calling useRouter() in setup (not inside onMounted) and wrapping paths with withBase() so it works on GitHub Pages subpaths.

Test plan

  • Visit docs root with navigator.language starting with zh → auto-redirects to /zh/
  • Visit docs root with English browser → auto-redirects to /en/
  • Manual hero buttons still work under base path

Copilot AI review requested due to automatic review settings May 27, 2026 11:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@RealKai42 RealKai42 added this pull request to the merge queue May 27, 2026
Merged via the queue into main with commit 3fa4e1a May 27, 2026
36 checks passed
@RealKai42 RealKai42 deleted the kaiyi/fix-doc branch May 27, 2026 11:40
@chatgpt-codex-connector
Copy link
Copy Markdown

💡 Codex Review

kimi-cli/docs/index.md

Lines 23 to 26 in 3a5f957

if (lang.startsWith('en')) {
router.go(withBase('/en/'))
} else {
router.go(withBase('/zh/'))

P2 Badge Keep English as the fallback locale

For browsers whose navigator.language is neither Chinese nor English (for example fr-FR, ja-JP, or an empty value), this condition now falls through to /zh/. Before this commit, all non-zh browsers landed on English, and the README's primary documentation links also point at /en/, so this regresses the default experience for most non-Chinese users. Check zh explicitly and keep /en/ as the fallback.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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