Fix/locale switch 448#1147
Conversation
lefarcen
left a comment
There was a problem hiding this comment.
Hi @masher-pp! 🎉
Wow, what an impressive PR fixing the locale switcher (Issue #448) while also enhancing our Chinese README with a clear contribution guide prompt — thank you for this thoughtful contribution! 🙌 The localStorage check is a smart fix for preserving user language selections, and the update banner positioning tweak looks clean.
A few quick thoughts:
- README.zh-CN.md: Consider also updating the English README.md with a similar contribution prompt for consistency across languages.
- apps/web/src/hooks/use-locale.tsx: Nice addition of manual selection check! The try-catch is good for robustness.
- apps/desktop/src/runtime-page.css: The right-align change for update-card improves layout balance.
This looks solid overall. We'll review promptly (target: 24h). Questions or updates? Push here!
Join communities:
- Feishu: https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=90emc2e9-86cd-4723-b455-ca41b70f162d
- Discord: https://discord.gg/nexu
Thanks for making Nexu better!
Nexu Team
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e91000e50f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (manualSelection === "en" || manualSelection === "zh") { | ||
| // User has manually selected a language, respect their choice | ||
| return; |
There was a problem hiding this comment.
Preserve server locale sync when localStorage has value
Returning immediately when localStorage contains "en"/"zh" skips the later syncDesktopLocale(localCandidate) path, so a client can get stuck with an unsynced controller locale. A concrete case is: first boot while getApiInternalDesktopPreferences() fails (or returns locale: null) writes local storage only, then on later boots this new early return prevents ever backfilling the controller preference; backend flows that read getDesktopLocale() (defaulting to "en" when unset) can continue emitting English while the UI remains Chinese.
Useful? React with 👍 / 👎.
修复bootstrapLocale函数race condition问题,当用户通过localStorage手动选择语言时,尊重用户选择,不覆盖现有设置。 - 修改文件: apps/web/src/hooks/use-locale.tsx - 新增逻辑: 在bootstrap过程中检查localStorage中的用户手动选择 - 修复问题: 欢迎页语言切换器无法改变UI语言的问题
e91000e to
323edbd
Compare
lefarcen
left a comment
There was a problem hiding this comment.
Hey @masher-pp! 👋 Thanks for the quick push update! 🚀
Re-reviewed the latest changes — the locale switcher fix in use-locale.tsx looks solid (smart localStorage check with try-catch for robustness). No new issues found, and prior suggestions (English README consistency) are stylistic.
This is looking great! Ready for final team review. Any questions, just push or comment.
Join communities:
- Feishu: https://applink.feishu.cn/client/chat/chatter/add_by_link?link_token=90emc2e9-86cd-4723-b455-ca41b70f162d
- Discord: https://discord.gg/nexu
Thanks for making Nexu better!
Nexu Team
What
在README.zh-CN.md中添加贡献指南提示,帮助新用户了解如何参与贡献
Why
完善项目的贡献引导,让更多开发者能够快速了解如何为Nexu项目贡献代码,提升开源社区参与度。
How
README.zh-CN.mdAffected areas
Checklist
Notes for reviewers
README.zh-CN.md文件