Repository navigation
为HMCL文档添加了en-us的支持 - #499
Open
I-am-shecatep wants to merge 2 commits into
Open
I-am-shecatep wants to merge 2 commits into
I-am-shecatep wants to merge 2 commits into
Conversation
- 新增 _plugins/i18n.rb:识别 `<name>_<locale>` 翻译文件,自动为英文页面生成 /en/ 路径,按页面切换站点标题/描述/导航,并改写正文中的站内链接 - _config.yml 增加 i18n.default_locale / i18n.locales 配置 - 新增 _data/i18n.yml、_data/en/navigation.yml、_data/en/groups.csv - 新增语言切换入口(_includes/masthead.html)与 hreflang 标注 - 集合列表页、上一页/下一页按当前语言过滤,避免中英页面互相跳转 - index.json 仅输出默认语言文章,保持 HMCL 客户端接口不变 - 404 页双语;README 增加多语言贡献约定
- 新增 46 篇 `_en.md` 英文翻译及 settings_en.yaml,覆盖 _docs、_launcher、 _modpack、_multiplayer、_downloads、_pages、_eula、_changelog 与首页 - 中文首页与贡献指南补充英文文档入口及翻译贡献说明 - 更新日志正文保持中文并在英文页面注明;EULA 为参考译文(以中文原版为准)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
本 PR 为文档站点补齐多语言支持:简体中文仍是默认语言、原有 URL 全部保持不变,在此基础上新增英文站点
/en/,为后续其他语言的翻译打好基础。因为咪没什么时间,翻译是让Deepseek干的,我审了一遍没发现什么问题,如果有问题还请大佬指正喵!
feat/i18n-en(基于main)实现方式
没有引入
jekyll-polyglot(其与{% link %}、静态资源及仓库自定义插件存在兼容问题),而是新增了一个轻量的 Jekyll 插件_plugins/i18n.rb:foo.md是默认语言(简体中文),foo_en.md是英文翻译;英文文件不需要手写permalink/lang/locale。/en前缀,例如:_launcher/isolation.md→/launcher/isolation.html_launcher/isolation_en.md→/en/launcher/isolation.htmlsite.title、site.description、导航(_data/en/navigation.yml)以及_data/en/下的数据文件(如 QQ 群列表groups.csv)按当前页面语言生效。locale参数,英文页面的「Toggle menu / Updated / On this page」等 UI 文案自动为英文,中文页面保持原样。<head>输出中英互指的hreflang标注。为适配上述机制,新增/覆盖了少量主题文件(
_includes/masthead.html、_includes/post_pagination.html、_layouts/collection.html),并移除了 locale 相关 include 的include_cached缓存。变更内容
基础设施(commit 1:
feat(i18n): add multilingual support with English site under /en/)_plugins/i18n.rb_config.yml:新增i18n.default_locale/i18n.locales配置_data/i18n.yml、_data/en/navigation.yml、_data/en/groups.csvindex.json只输出默认语言文章,保持 HMCL 客户端接口不变404页双语;README 增加「多语言」贡献约定英文翻译(commit 2:
docs(i18n): add English translations for all documentation)_en.md+settings_en.yaml,覆盖:首页、设置页、校验页、_docs、_launcher、_modpack、_multiplayer、_downloads、_pages、_eula以及更新日志索引页对现有功能的影响
index.json输出均保持不变(index.json与改动前逐字节一致),HMCL 客户端解析/changelog/*.html不受影响。bundle exec jekyll build),CI 与 PR 预览流程无需改动。验证
JEKYLL_ENV=production、以及带baseurl(模拟 PR 预览)三种构建均成功;生成 47 个英文页面,中文页面数量不变。/(中文)、/en/(英文)已知取舍
_changelogs/)目前只有中文内容,英文更新日志页展示中文条目并在页面中注明。jekyll-feed生成的 RSS 中中英文章会混合(插件本身不支持按语言过滤),后续可考虑拆分 feed。_eula/hmcl_en.md为非官方参考译文,页面中已注明以中文原版为准。_docs/faq_en.md中讨论「材质包/纹理包」中文译名的段落刻意保留了中文术语。