summaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-09-19 21:54:39 +0800
committerEltrac <hi@guhub.cn>2025-09-19 21:54:39 +0800
commitbf470534edec07ec7ae6c6afc32a3ed2e81051eb (patch)
treec35aa4bd11f0bb460fecdeb450f81dee8479f7f6 /layouts
parent9b0e61c5d80f389083b79fddf0f87d0474610f3e (diff)
parentd007885a3e3f6feabefbfcf28d210cc43edc3650 (diff)
Merge branch 'master' of https://github.com/BigCoke233/geek-death-project
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_partials/components/date.html23
-rw-r--r--layouts/_partials/posts/action-menu.html30
2 files changed, 35 insertions, 18 deletions
diff --git a/layouts/_partials/components/date.html b/layouts/_partials/components/date.html
index 1998202f..5b8b8278 100644
--- a/layouts/_partials/components/date.html
+++ b/layouts/_partials/components/date.html
@@ -1,15 +1,15 @@
{{ if .Date }}
{{ $hour := .Date.Hour }}
{{ $fuzzyTimes := slice
- (dict "limit" 5 "label" "凌晨")
- (dict "limit" 7 "label" "清晨")
- (dict "limit" 11 "label" "早上")
- (dict "limit" 13 "label" "中午")
- (dict "limit" 17 "label" "下午")
- (dict "limit" 19 "label" "傍晚")
- (dict "limit" 22 "label" "晚上")
+ (dict "limit" 5 "label" (T "fuzzyTimes.afterMidnight"))
+ (dict "limit" 7 "label" (T "fuzzyTimes.earlyMorning"))
+ (dict "limit" 11 "label" (T "fuzzyTimes.morning"))
+ (dict "limit" 13 "label" (T "fuzzyTimes.noon"))
+ (dict "limit" 17 "label" (T "fuzzyTimes.afternoon"))
+ (dict "limit" 19 "label" (T "fuzzyTimes.evening"))
+ (dict "limit" 22 "label" (T "fuzzyTimes.night"))
}}
- {{ $fuzzyTime := "深夜" }} {{/* default */}}
+ {{ $fuzzyTime := (T "fuzzyTimes.midnight") }} {{/* default */}}
{{ range $fuzzyTimes }}
{{ if lt $hour .limit }}
{{ $fuzzyTime = .label }}
@@ -21,6 +21,11 @@
datetime="{{ .Date.Format "2006-01-02 15:04:05 MST" }}"
data-pagefind-sort="date[datetime], weight[data-weight]"
data-weight="{{ if .Params.featured }}30{{ else }}20{{ end }}">
- {{ .Date.Format "2006年1月2日" }} {{ $fuzzyTime }}
+ {{ if eq .Site.Language.Lang "zh" }}
+ {{ .Date.Format "2006年1月2日" }}
+ {{ else }}
+ {{ .Date.Format "January 2, 2006" }},
+ {{ end }}
+ {{ $fuzzyTime }}
</time>
{{ end }}
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 @@
<div class="flex justify-between items-center mb-6">
<div class="flex gap-2">
<button class="dark:invert flex items-center justify-center gap-1.5 min-w-12 h-12 px-2 border-none bg-transparent text-gray-600 cursor-pointer relative transition-all duration-200 hover:bg-black/5 hover:rounded-lg group"
- id="comments-toggle" title="评论" data-tooltip>
- <img src="/img/comments.svg" width="20" height="20" alt="评论" class="brightness-40 flex-shrink-0 dark:brightness-70 dark:contrast-120" />
+ id="comments-toggle" title="{{ T "actionMenu.comment" }}" data-tooltip>
+ <img src="/img/comments.svg" width="20" height="20"
+ alt="{{ T "actionMenu.comment" }}"
+ class="brightness-40 flex-shrink-0 dark:brightness-70 dark:contrast-120" />
<span class="text-xs font-bold text-gray-600 min-w-4 text-center bg-white/90 rounded-xl px-1.5 py-0.5 shadow-sm dark:text-gray-400 dark:bg-black/70" id="comment-count">...</span>
</button>
@@ -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>
- <img src="/img/heart-organ.svg" width="20" height="20" alt="点赞" class="brightness-40 flex-shrink-0 transition-all duration-300 dark:brightness-70 dark:contrast-120" id="like-icon-{{ .File.UniqueID | urlize }}" />
+ <img src="/img/heart-organ.svg" width="20" height="20"
+ alt="{{ T "actionMenu.like" }}"
+ class="brightness-40 flex-shrink-0 transition-all duration-300 dark:brightness-70 dark:contrast-120" id="like-icon-{{ .File.UniqueID | urlize }}" />
<span class="text-xs font-bold text-gray-600 min-w-4 text-center bg-white/90 rounded-xl px-1.5 py-0.5 shadow-sm dark:text-gray-400 dark:bg-black/70" id="like-count-{{ .File.UniqueID | urlize }}">...</span>
</button>
</div>
</div>
+ {{ if eq .Site.Language.Lang "zh" }}
<div class="flex gap-1">
<a href="https://t.me/geedeapro" target="_blank" data-tooltip
- 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="Telegram 频道:大脑充血" data-umami-event="✈️ Click Telegram link from post tabs">
- <img src="/img/radio.svg" width="16" height="16" alt="Telegram" class="brightness-40 flex-shrink-0 dark:brightness-70 dark:contrast-120" />
+ 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">
+ <img src="/img/radio.svg" width="16" height="16"
+ alt="{{ T "actionMenu.telegramChannel" }}"
+ class="brightness-40 flex-shrink-0 dark:brightness-70 dark:contrast-120" />
</a>
<a href="/sponsor" data-tooltip
- 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="赞助作者" data-umami-event="💗 Click sponsor button from post tabs">
- <img src="/img/coffee.svg" width="16" height="16" alt="赞助" class="brightness-40 flex-shrink-0 dark:brightness-70 dark:contrast-120" />
+ 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">
+ <img src="/img/coffee.svg" width="16" height="16"
+ alt="{{ T "actionMenu.sponsor" }}"
+ class="brightness-40 flex-shrink-0 dark:brightness-70 dark:contrast-120" />
</a>
</div>
+ {{ end }}
</div>
<!-- 评论区域 -->