Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Track3/hermit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrack3 <pengliabc@live.cn>2018-12-14 10:17:48 +0300
committerTrack3 <pengliabc@live.cn>2018-12-14 10:17:48 +0300
commit8711c169be1a680f83f35ed362c10776a5a6abc8 (patch)
tree4780f209649d85b9984c95311821131765a79348
parentc128b75243bc13e01385ee210cd28cceff549f09 (diff)
Add i18n support for translation of stringsv1.1.0
* Also add Simplified Chinese translations * See #3
-rw-r--r--exampleSite/config.toml1
-rw-r--r--i18n/en.toml24
-rw-r--r--i18n/zh-hans.toml24
-rw-r--r--layouts/404.html6
-rw-r--r--layouts/posts/single.html8
5 files changed, 56 insertions, 7 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 683622a..93b6d81 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -1,5 +1,6 @@
baseURL = "https://example.com"
languageCode = "en-us"
+defaultContentLanguage = "en"
title = "Hugo Hermit"
theme = "hermit"
# enableGitInfo = true
diff --git a/i18n/en.toml b/i18n/en.toml
new file mode 100644
index 0000000..b3316f3
--- /dev/null
+++ b/i18n/en.toml
@@ -0,0 +1,24 @@
+# Translations for English
+# https://gohugo.io/content-management/multilingual/#translation-of-strings
+
+# 404.html
+#
+[notFound]
+other = "Oops, page not found…"
+
+[home]
+other = "Home"
+
+[archives]
+other = "Archives"
+
+# posts/single.html
+#
+[wordCount]
+other = "{{ .WordCount }} Words"
+
+[newer]
+other = "Newer"
+
+[older]
+other = "Older"
diff --git a/i18n/zh-hans.toml b/i18n/zh-hans.toml
new file mode 100644
index 0000000..605cd6b
--- /dev/null
+++ b/i18n/zh-hans.toml
@@ -0,0 +1,24 @@
+# Translations for Simplified Chinese - 简体中文
+# https://gohugo.io/content-management/multilingual/#translation-of-strings
+
+# 404.html
+#
+[notFound]
+other = "糟糕,您要访问的页面不存在……"
+
+[home]
+other = "主页"
+
+[archives]
+other = "归档"
+
+# posts/single.html
+#
+[wordCount]
+other = "{{ .WordCount }} 字"
+
+[newer]
+other = "新"
+
+[older]
+other = "旧"
diff --git a/layouts/404.html b/layouts/404.html
index 535fd1a..691ac08 100644
--- a/layouts/404.html
+++ b/layouts/404.html
@@ -5,10 +5,10 @@
</p>
<div class="banner-404">
<h1>404</h1>
- <p>Oops, page not found…</p>
+ <p>{{ i18n "notFound" }}</p>
<p class="btn-404">
- <a href="{{.Site.BaseURL}}"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-home"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>Home</a>
- <a href="{{ "posts" | absURL }}"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-archive"><polyline points="21 8 21 21 3 21 3 8"></polyline><rect x="1" y="3" width="22" height="5"></rect><line x1="10" y1="12" x2="14" y2="12"></line></svg>Archives</a>
+ <a href="{{.Site.BaseURL}}"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-home"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>{{ i18n "home" }}</a>
+ <a href="{{ "posts" | absURL }}"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-archive"><polyline points="21 8 21 21 3 21 3 8"></polyline><rect x="1" y="3" width="22" height="5"></rect><line x1="10" y1="12" x2="14" y2="12"></line></svg>{{ i18n "archives" }}</a>
</p>
</div>
</div>
diff --git a/layouts/posts/single.html b/layouts/posts/single.html
index 107b6d3..e8b37a8 100644
--- a/layouts/posts/single.html
+++ b/layouts/posts/single.html
@@ -4,7 +4,7 @@
{{ define "main" }}
{{- with .Params.featuredImg }}
- <div id="bg-img" class="bg-img" style="background-image: url({{.}});" onclick="showContent()"></div>
+ <div id="bg-img" class="bg-img" style="background-image: url({{.}});" onclick="showContent()"></div>
{{- end }}
<main class="site-main section-inner animated fadeIn faster">
<article class="thin">
@@ -25,7 +25,7 @@
{{- end }}
</p>
{{- end }}
- <p><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>{{ .WordCount }} Words</p>
+ <p><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>{{ i18n "wordCount" . }}</p>
<p><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-calendar"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>{{ dateFormat .Site.Params.dateformNumTime .Date.Local }}</p>
{{- if .GitInfo }}
<p><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-git-commit"><circle cx="12" cy="12" r="4"></circle><line x1="1.05" y1="12" x2="7" y2="12"></line><line x1="17.01" y1="12" x2="22.96" y2="12"></line></svg><a href="{{ .Site.Params.gitUrl -}}{{ .GitInfo.Hash }}" target="_blank" rel="noopener">{{ .GitInfo.AbbreviatedHash }}</a> @ {{ dateFormat .Site.Params.dateformNum .GitInfo.AuthorDate.Local }}</p>
@@ -35,12 +35,12 @@
<div class="post-nav thin">
{{- with .NextInSection }}
<a class="next-post" href="{{ .Permalink }}">
- <span class="post-nav-label"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>&nbsp;Newer</span><br><span>{{ .Title }}</span>
+ <span class="post-nav-label"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>&nbsp;{{ i18n "newer" }}</span><br><span>{{ .Title }}</span>
</a>
{{- end }}
{{- with .PrevInSection }}
<a class="prev-post" href="{{ .Permalink }}">
- <span class="post-nav-label">Older&nbsp;<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg></span><br><span>{{ .Title }}</span>
+ <span class="post-nav-label">{{ i18n "older" }}&nbsp;<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg></span><br><span>{{ .Title }}</span>
</a>
{{- end }}
</div>