-
Notifications
You must be signed in to change notification settings - Fork 22
本地化网站 #327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
本地化网站 #327
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements internationalization (i18n) for the HMCL documentation website by adding multi-language support through Jekyll Polyglot. The refactoring splits previously combined Chinese/English pages into separate language-specific files and introduces automatic language detection and redirection.
- Adds
jekyll-polyglotplugin for multi-language support with Chinese, English, and "und" (undetermined) languages - Splits bilingual content pages into separate
_en.mdand_zh.mdfiles with language-specific permalinks - Creates a
select_language.htmllayout that automatically redirects users based on browser language preference
Reviewed Changes
Copilot reviewed 45 out of 45 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
_layouts/select_language.html |
New layout template implementing automatic language detection and redirection |
index.md, index_en.md, index_zh.md |
Splits homepage into language-specific versions |
_downloads/**/*.md |
Refactors all download pages from bilingual to separate language files |
_config.yml |
Configures Polyglot plugin with supported languages |
Gemfile |
Adds jekyll-polyglot dependency |
_data/*/navigation.yml |
Adds language-specific navigation files |
_docs/crash-support-group.md |
Updates asset link references |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This comment was marked as resolved.
This comment was marked as resolved.
现在 HTML 的 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 52 out of 52 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
|
|
||
| <script> | ||
| /* 等待 5 秒. */ |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment is written in Chinese ('Wait 5 seconds') in an English language file. Should be changed to English.
|
|
||
|
|
||
| <script> | ||
| /* 等待 5 秒. */ |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment is written in Chinese ('Wait 5 seconds') in an English language file. Should be changed to English.
|
|
||
|
|
||
| <script> | ||
| /* 等待 5 秒. */ |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment is written in Chinese ('Wait 5 seconds') in an English language file. Should be changed to English.
|
|
||
|
|
||
| <script> | ||
| /* 等待 5 秒. */ |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment is written in Chinese ('Wait 5 seconds') in an English language file. Should be changed to English.
| /* 等待 5 秒. */ | |
| /* Wait 5 seconds. */ |
|
「当前站点为预览构建而非官方文档。如需反馈问题,请前往 #XXX 留言。」 这句话没本地化。 |
应当在本 PR 中一并完成相关修改。 |
|
从 minimal-mistakes 中复制了一部分文件,现在网站大部分地方应该已经完成本地化了。 |
|
对于提供了多语言的文章,是否需要在文章开头添加原始文章以及译者信息。 |
我考虑做一个不同语言页面之间切换的按钮
感觉不是很必要? |
对于广大 (潜在的) 国际用户而言,英文文章的译者信息可以提供一个参考。 例如文章是否为 LLM 翻译、译者是否为原始文章作者、译者相关 credit、译者是否为 HMCL 活跃贡献者/维护者,等等。 这样有助于提高透明度。 |
|
我感觉会不会有些复杂了,如果给每个语言单独配置一套 config 然后分别生成产物会好一些。 我之前通过上述方案实现了一个版本,但如果是 /{lang}/* 这种的会更简单一点,因为多语言并不共用同一文件夹所以无需合并文件夹的逻辑。 比如: 先构建跳转页面到 _site |
我没理解你说的方案哪里简单了,我觉得比现在的方案复杂多了。 |
本 PR 实现了网站的本地化。
现在网站支持英语和中文,入口点分别为
https://docs.hmcl.net/en/和https://docs.hmcl.net/zh/。访问https://docs.hmcl.net将会通过 JS 脚本判断用户的语言,然后自动跳转到合适的页面。目前我翻译了部分页面,未翻译的页面会自动回退到中文。
页面中一些元素(比如 title)目前难以进行本地化。我在考虑未来不再使用 gem 安装 minimal-mistakes 主题,而是将该主题完整复制到本仓库中,这样我们可以更深度地对其进行定制。