Skip to content

Commit 7562f9f

Browse files
committed
alert 多语言支持
1 parent 9a95467 commit 7562f9f

File tree

5 files changed

+33
-11
lines changed

5 files changed

+33
-11
lines changed

_data/plugins/auto_alert.en.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
note:
2+
title: Note
3+
class_name: notice--info
4+
tip:
5+
title: Tip
6+
class_name: notice--success
7+
important:
8+
title: Important
9+
class_name: notice--primary
10+
warning:
11+
title: Warning
12+
class_name: notice--warning
13+
caution:
14+
title: Caution
15+
class_name: notice--danger
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
note:
2+
title: 注意
3+
class_name: notice--info
4+
tip:
5+
title: 提示
6+
class_name: notice--success
7+
important:
8+
title: 重要
9+
class_name: notice--primary
10+
warning:
11+
title: 警告
12+
class_name: notice--warning
13+
caution:
14+
title: 謹慎
15+
class_name: notice--danger

_plugins/auto-alert.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
next unless doc.output_ext == ".html"
55
site = doc.site
66
next unless site.data["plugins"]
7-
alert_type = site.data["plugins"]["auto_alert"]
7+
locale = doc.data["locale"]
8+
alert_type = site.data["plugins"]["auto_alert.#{locale}"] if locale
9+
alert_type = site.data["plugins"]["auto_alert"] unless alert_type
810
next unless alert_type
911

1012
fragment = Nokogiri::HTML::DocumentFragment.parse(doc.content)

index.en.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ title: Get started
44
author: wifi-left
55
---
66

7-
<!--{% comment %}-->
87
> [!NOTE]
9-
> <!--{% endcomment %}-->
10-
> <!----{{ '>' }} **Note** <br> {{ '<' }}!---->
118
> If you encounter a BUG, please send feedback in time to [HMCL/issues](https://github.com/HMCL-dev/HMCL/issues).\
129
> You can also submit your suggestions here.
13-
<!----{{ '>' }}
14-
{: .notice--info }

index.zh-Hant.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ title: 新手導航
44
author: wifi-left
55
---
66

7-
<!--{% comment %}-->
87
> [!NOTE]
9-
> <!--{% endcomment %}-->
10-
> <!----{{ '>' }} **注意** <br> {{ '<' }}!---->
118
> 如果您遇到 BUG,請及時在 [HMCL/issues](https://github.com/HMCL-dev/HMCL/issues) 髮送反饋。\
129
> 您也可以在這裡提交您的建議。
13-
<!----{{ '>' }}
14-
{: .notice--info }

0 commit comments

Comments
 (0)