From eee9b7c4ded1cb9e5ce18e07f6311b7846b61e6a Mon Sep 17 00:00:00 2001 From: Eltrac Date: Fri, 19 Sep 2025 17:01:29 +0800 Subject: feat(i18n): add i18n support for action menu Former-commit-id: d007885a3e3f6feabefbfcf28d210cc43edc3650 --- i18n/en.yml | 6 ++++++ i18n/zh.yml | 6 ++++++ layouts/_partials/posts/action-menu.html | 30 +++++++++++++++++++++--------- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/i18n/en.yml b/i18n/en.yml index 9c210c0a..a303a633 100644 --- a/i18n/en.yml +++ b/i18n/en.yml @@ -50,3 +50,9 @@ fuzzyTimes: evening: Evening night: Night midnight: Midnight +actionMenu: + telegramChannel: Telegram Channel + sponsor: Buy me a coffee + comment: Comment + like: Sacrifice your heart + liked: You've already made your sacrifice diff --git a/i18n/zh.yml b/i18n/zh.yml index f246a18a..37b2511d 100644 --- a/i18n/zh.yml +++ b/i18n/zh.yml @@ -50,3 +50,9 @@ fuzzyTimes: evening: '傍晚' night: '晚上' midnight: '深夜' +actionMenu: + telegramChannel: 'Telegram 频道' + sponsor: 赞助作者 + comment: 评论 + like: 为这篇文章献上心脏 + liked: 你已经献上心脏了 diff --git a/layouts/_partials/posts/action-menu.html b/layouts/_partials/posts/action-menu.html index 63c7ba5c..d05a61d1 100644 --- a/layouts/_partials/posts/action-menu.html +++ b/layouts/_partials/posts/action-menu.html @@ -3,8 +3,10 @@
@@ -15,25 +17,35 @@ hover:bg-black/5 hover:rounded-lg group animate-count-infinite" onclick="sendLike('{{ .File.UniqueID | urlize }}')" id="like-btn-{{ .File.UniqueID | urlize }}" - title="为这篇文章献上心脏" - data-liked-title="你已经献上心脏了" + title="{{ T "actionMenu.like" }}" + data-liked-title="{{ T "actionMenu.liked" }}" data-tooltip> - 点赞 + {{ T ...
+ {{ if eq .Site.Language.Lang "zh" }}
- Telegram + class="dark:invert flex items-center justify-center gap-1.5 min-w-8 h-8 px-1 border-none bg-transparent text-gray-600 cursor-pointer relative transition-all duration-200 hover:opacity-70 group" + title="{{ T "actionMenu.telegramChannel" }}" data-umami-event="✈️ Click Telegram link from post tabs"> + {{ T - 赞助 + class="dark:invert flex items-center justify-center gap-1.5 min-w-8 h-8 px-1 border-none bg-transparent text-gray-600 cursor-pointer relative transition-all duration-200 hover:opacity-70 group" + title="{{ T "actionMenu.sponsor" }}" data-umami-event="💗 Click sponsor button from post tabs"> + {{ T
+ {{ end }} -- cgit v1.2.3