Skip to content

Commit a05d6e8

Browse files
committed
导航首页多语言支持
1 parent b759206 commit a05d6e8

File tree

9 files changed

+180
-19
lines changed

9 files changed

+180
-19
lines changed

_data/navigation.yml

Lines changed: 105 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,113 @@ docs:
4141
- title: 添加默认 authlib-injector 验证服务器
4242
url: /launcher/authlib-injector.html
4343
description: 本文将告诉你如何设置默认的验证服务器。
44-
- title: 其他
44+
- title: 其它
4545
children:
46-
- title: 为 HMCL 做出贡献
46+
- title: 贡献指南
4747
url: /contribution.html
48-
- title: HMCL GitHub 地址
48+
- title: 官方网站
49+
url: https://hmcl.huangyuhui.net
50+
- title: 项目仓库
4951
url: https://github.com/HMCL-dev/HMCL
50-
- title: HMCL 帮助文档 GitHub 地址
52+
- title: 文档仓库
5153
url: https://github.com/HMCL-dev/HMCL-docs
52-
- title: HMCL 官网
54+
55+
main_zh-TW:
56+
- title: 常見問題
57+
url: /zh-TW/faq.html
58+
59+
docs_zh-TW:
60+
- title: 問題集合
61+
children:
62+
- title: 常見問題
63+
url: /zh-TW/faq.html
64+
- title: 啟動器使用相關
65+
url: /zh-TW/launcher/
66+
- title: 整合包幫助
67+
url: /zh-TW/modpack/
68+
- title: 多人聯機幫助
69+
url: /zh-TW/multiplayer/
70+
- title: 使用者幫助
71+
children:
72+
- title: 版本隔離
73+
url: /zh-TW/launcher/isolation.html
74+
description: 本文可以幫助你更好的分離版本間的地圖、模組等內容。
75+
- title: 設置離線皮膚
76+
url: /zh-TW/launcher/offline-skin.html
77+
description: 本文將告訴你如何設置一個屬於自己的離線皮膚。
78+
- title: HMCL 的自動安裝使用教程
79+
url: /zh-TW/launcher/auto-installing.html
80+
description: 本文將告訴你如何用 HMCL 安裝 Forge、Fabric、Fabric API、LiteLoader、Optifine 以及 模組 等。
81+
- title: 安裝光影
82+
url: /zh-TW/launcher/shader.html
83+
description: 本文將告訴你如何安裝光影。
84+
- title: 設置項詳解
85+
url: /zh-TW/launcher/set-item-details.html
86+
description: 這篇文章針對 HMCL 的各個設置項進行了詳細的解釋。
87+
- title: 開髮者幫助
88+
children:
89+
- title: 製作 HMCL 格式的數據包
90+
url: /zh-TW/launcher/datapack.html
91+
description: 本文將告訴你如何製作 HMCL 能夠識別的數據包(Datapacks)。
92+
- title: 製作整合包
93+
url: /zh-TW/modpack/serverpack.html
94+
description: 本文將告訴你如何製作整合包。
95+
- title: 添加默認 authlib-injector 驗証服務器
96+
url: /zh-TW/launcher/authlib-injector.html
97+
description: 本文將告訴你如何設置默認的驗証服務器。
98+
- title: 其它
99+
children:
100+
- title: 貢獻指南
101+
url: /zh-TW/contribution.html
102+
- title: 官方網站
53103
url: https://hmcl.huangyuhui.net
104+
- title: 項目倉庫
105+
url: https://github.com/HMCL-dev/HMCL
106+
- title: 文檔倉庫
107+
url: https://github.com/HMCL-dev/HMCL-docs
108+
109+
main_en:
110+
- title: FAQ
111+
url: /faq.html
112+
113+
docs_en:
114+
- title: Questions
115+
children:
116+
- title: FAQ
117+
url: /en/faq.html
118+
- title: Launcher
119+
url: /en/launcher/
120+
- title: Modpack
121+
url: /en/modpack/
122+
- title: Multiplayer
123+
url: /en/multiplayer/
124+
- title: User Guide
125+
children:
126+
- title: Isolation
127+
url: /en/launcher/isolation.html
128+
- title: Offline Skin
129+
url: /en/launcher/offline-skin.html
130+
- title: Automatic Installing
131+
url: /en/launcher/auto-installing.html
132+
- title: Shader
133+
url: /en/launcher/shader.html
134+
- title: Set Item Details
135+
url: /en/launcher/set-item-details.html
136+
- title: Developer Guide
137+
children:
138+
- title: Datapack
139+
url: /en/launcher/datapack.html
140+
- title: Serverpack
141+
url: /en/modpack/serverpack.html
142+
- title: Authlib Injector
143+
url: /en/launcher/authlib-injector.html
144+
- title: Other
145+
children:
146+
- title: Contribution Guide
147+
url: /en/contribution.html
148+
- title: Official Website
149+
url: https://hmcl.huangyuhui.net
150+
- title: Project Repository
151+
url: https://github.com/HMCL-dev/HMCL
152+
- title: Documentation Repository
153+
url: https://github.com/HMCL-dev/HMCL-docs

_data/ui-text.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
zh-TW: &PATCH_ZH_HANT
2+
skip_links: 跳過連結
3+
skip_primary_nav: 跳至主導覽
4+
skip_content: 跳至內容
5+
skip_footer: 跳至頁尾
6+
pagination_previous: 上一頁
7+
pagination_next: 下一頁
8+
menu_label: 選單
9+
search_label: 搜尋
10+
toc_label: 本頁目錄
11+
share_on_label: 分享至
12+
comments_title: 留言
13+
more_label: 閱讀更多
14+
related_label: 您可能也會有興趣
15+
follow_label: 追蹤:
16+
feed_label: 訂閱 Feed
17+
powered_by: 採用技術:
18+
email_label: 電子郵件
19+
undefined_wpm: 設定檔 (_config.yml) 中缺少 `words_per_minute` 參數
20+
comment_form_info: 您的電子郵件不會被公開。必填欄位已標註星號 (*)
21+
comment_form_comment_label: 留言
22+
comment_form_name_label: 名稱
23+
comment_form_email_label: 電子郵件地址
24+
comment_form_website_label: 網站 (選填)
25+
comment_error_msg: 抱歉,您提交的資料有誤。請確認所有必填欄位皆已正確填寫後再試一次。
26+
search_label_text: 輸入您要搜尋的關鍵字...
27+
search_placeholder_text: 輸入您要搜尋的關鍵字...
28+
search_algolia_no_results: 找不到結果
29+
results_found: 找到結果
30+
back_to_top: 回到頁首
31+
zh-HK:
32+
<<: *PATCH_ZH_HANT

_includes/masthead.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
{% if site.subtitle %}<span class="site-subtitle">{{ site.subtitle | escape_once | strip }}</span>{% endif %}
1414
</a>
1515
<ul class="visible-links">
16-
{%- for link in site.data.navigation.main -%}
16+
{% assign nav_key = "main_" | append: locale %}
17+
{% assign nav_main = site.data.navigation[nav_key] | default: site.data.navigation.main %}
18+
{%- for link in nav_main -%}
1719
<li class="masthead__menu-item">
1820
<a
1921
href="{{ link.url | relative_url }}"

_includes/nav_list

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
<label for="ac-toc">{{ site.data.ui-text[locale].menu_label | default: "Toggle Menu" }}</label>
66
<ul class="nav__items">
77
{% for navname in include.nav %}
8-
{% assign navigation = site.data.navigation[navname] %}
8+
{% assign nav_key = navname | append: "_" | append: locale %}
9+
{% assign navigation = site.data.navigation[nav_key] | default: site.data.navigation[navname] %}
910
{% for nav in navigation %}
1011
<li>
1112
{% if nav.url %}

_layouts/document.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
<img src="https://hits.zkitefly.eu.org/?tag={{ page.url | absolute_url | url_encode }}" alt="Hits" decoding="async">
77
{% endif %}
88

9+
{% if page.origin_locale and page.locale and page.origin_locale != page.locale %}
10+
<div class="notice--warning">当前页面语言与实际语言不一致</div>
11+
{% endif %}
12+
913
<div class="notice--info">
1014
<p>本文由 {{ page.author | default: '未署名用户' }} 创建{% if page.contributors %},并由 {{ page.contributors | join: ' ' }} 编辑{% endif %}。</p>
1115
</div>

_layouts/home.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44

55
{{ content }}
66

7+
{% assign nav_key = "docs_" | append: page.locale %}
8+
{% assign nav_docs = site.data.navigation[nav_key] | default: site.data.navigation.docs %}
9+
710
{% capture list %}
8-
{% for group in site.data.navigation.docs -%}
11+
{% for group in nav_docs -%}
912
## {{ group.title }}
1013
{% for item in group.children -%}
1114
1. [{{ item.title }}]({{ item.url | relative_url }})

index.en.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
layout: home
3+
title: Get started
4+
author: wifi-left
5+
---
6+
7+
<!--{% comment %}-->
8+
> [!NOTE]
9+
> <!--{% endcomment %}-->
10+
> <!----{{ '>' }} **Notice** <br> {{ '<' }}!---->
11+
> The articles were written in Simplified Chinese. If you want to help translate them, please send a pull request to [HMCL-docs/pulls](https://github.com/HMCL-dev/HMCL-docs/pulls).\
12+
> If you encounter a BUG, please send feedback in time to [HMCL/issues](https://github.com/HMCL-dev/HMCL/issues).\
13+
> You can also submit your suggestions here.
14+
<!----{{ '>' }}
15+
{: .notice--info }

index.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
11
---
22
layout: home
3-
title: HMCL 新手导航
3+
title: 新手导航
44
author: wifi-left
55
---
66

7-
<!--{% comment %}-->
8-
> [!NOTE]
9-
> <!--{% endcomment %}-->
10-
> <!----{{ '>' }} **Notice** <br> {{ '<' }}!---->
11-
> The articles were written in Simplified Chinese. If you want to help translate them, please send a pull request to [HMCL-docs/pulls](https://github.com/HMCL-dev/HMCL-docs/pulls). Or you can enable your translation tool to read.\
12-
> If you encounter a BUG, please send feedback in time to [HMCL/issues](https://github.com/HMCL-dev/HMCL/issues).\
13-
> You can also submit your suggestions here.
14-
<!----{{ '>' }}
15-
{: .notice--info }
16-
177
<!--{% comment %}-->
188
> [!NOTE]
199
> <!--{% endcomment %}-->

index.zh-TW.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
layout: home
3+
title: 新手導航
4+
author: wifi-left
5+
---
6+
7+
<!--{% comment %}-->
8+
> [!NOTE]
9+
> <!--{% endcomment %}-->
10+
> <!----{{ '>' }} **注意** <br> {{ '<' }}!---->
11+
> 如果您遇到 BUG,請及時在 [HMCL/issues](https://github.com/HMCL-dev/HMCL/issues) 髮送反饋。\
12+
> 您也可以在這裡提交您的建議。
13+
<!----{{ '>' }}
14+
{: .notice--info }

0 commit comments

Comments
 (0)