summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--i18n/en.yml9
-rw-r--r--i18n/zh.yml9
-rw-r--r--layouts/partials/components/comment.html12
-rw-r--r--layouts/partials/footer.html4
-rw-r--r--layouts/partials/scripts.html2
-rw-r--r--layouts/section/posts.html4
6 files changed, 25 insertions, 15 deletions
diff --git a/i18n/en.yml b/i18n/en.yml
new file mode 100644
index 00000000..03b0384f
--- /dev/null
+++ b/i18n/en.yml
@@ -0,0 +1,9 @@
+lang: en
+archivePage:
+ postCountMonthly: '{{ . }} POSTS'
+ postCountAnnual: '{{ . }} TOTAL POSTS'
+postPage:
+ commentNotLoaded: if comment is not loaded, please try refreshing
+footer:
+ wordCount: '🪦 {{ . }} words are buried here'
+ licenseStatement: 'Licensed under {{ . }}'
diff --git a/i18n/zh.yml b/i18n/zh.yml
new file mode 100644
index 00000000..2fd051f5
--- /dev/null
+++ b/i18n/zh.yml
@@ -0,0 +1,9 @@
+lang: zh-CN
+archivePage:
+ postCountMonthly: '{{ . }} 篇文章'
+ postCountAnnual: '共计 {{ . }} 篇文章'
+postPage:
+ commentNotLoaded: 如果评论未加载,请尝试刷新页面
+footer:
+ wordCount: '🪦 {{ . }} 字在这里死去'
+ licenseStatement: '以 {{ . }} 协议授权'
diff --git a/layouts/partials/components/comment.html b/layouts/partials/components/comment.html
index f3cdbded..0058713f 100644
--- a/layouts/partials/components/comment.html
+++ b/layouts/partials/components/comment.html
@@ -2,11 +2,7 @@
<div class="post-comments">
<div class="giscus">
<p style="text-align:center">
- {{ if eq .Site.Language.Lang "en" }}
- if comment is not loaded, please try refreshing
- {{ else if eq .Site.Language.Lang "zh" }}
- 如果评论未加载,请尝试刷新页面
- {{ end }}
+ {{ T "postPage.commentNotLoaded" }}
</p>
</div>
{{ if eq .Site.Language.Lang "zh" }}
@@ -23,11 +19,7 @@
data-emit-metadata="0"
data-input-position="top"
data-theme="preferred_color_scheme"
- {{ if eq .Site.Language.Lang "en" }}
- data-lang="en"
- {{ else if eq .Site.Language.Lang "zh" }}
- data-lang="zh-CN"
- {{ end }}
+ data-lang="{{ T "lang" }}"
crossorigin="anonymous"
async>
</script>
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 8f19be9f..acf81efd 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -1,7 +1,7 @@
<footer id="footer">
<section id="footer-copyright">
<p class="copyright">&copy; 2022-{{ now | dateFormat "2006" }} <a href="https://www.guhub.cn/" target="_blank">Eltrac</a></p>
- <p class="license">Licensed by <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank">CC BY-SA 4.0</a></p>
+ <p class="license">{{ T "footer.licenseStatement" (printf "<a href=\"https://creativecommons.org/licenses/by-sa/4.0/\" target=\"_blank\">CC BY-SA 4.0</a>") | safeHTML }}</p>
</section>
<section id="footer-links">
<ul class="footer-navigation">
@@ -24,6 +24,6 @@
{{ range (where .Site.Pages "Kind" "page" )}}
{{$scratch.Add "total" .WordCount}}
{{ end }}
- <p class="word-count">🪦 {{$scratch.Get "total" }} words in total</p>
+ <p class="word-count">{{ T "footer.wordCount" ($scratch.Get "total") }}</p>
</section>
</footer>
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html
index 9c980c77..95010ada 100644
--- a/layouts/partials/scripts.html
+++ b/layouts/partials/scripts.html
@@ -45,7 +45,7 @@ function loadGiscus() {
script.setAttribute('data-emit-metadata', '0');
script.setAttribute('data-input-position', 'bottom');
script.setAttribute('data-theme', 'light');
- script.setAttribute('data-lang', 'en');
+ script.setAttribute('data-lang', '{{ T "lang" }}');
script.crossOrigin = 'anonymous';
script.async = true;
diff --git a/layouts/section/posts.html b/layouts/section/posts.html
index 03668a6d..de06b2aa 100644
--- a/layouts/section/posts.html
+++ b/layouts/section/posts.html
@@ -11,7 +11,7 @@
<section class="posts-year-archive">
<h1 class="posts-year-title">
{{ .Key }}
- <small class="font-mono">{{ len .Pages }} TOTAL POSTS</small>
+ <small class="font-mono">{{ T "archivePage.postCountAnnual" (len .Pages) }}</small>
</h1>
{{ range .Pages.GroupByDate "January" }}
@@ -19,7 +19,7 @@
<summary>
<h2 class="posts-month-title">
{{ .Key }}
- <small class="font-mono">{{ len .Pages }} POSTS</small>
+ <small class="font-mono">{{ T "archivePage.postCountMonthly" (len .Pages) }}</small>
</h2>
</summary>
<ul>