diff options
-rw-r--r-- | data/even/default.toml | 47 | ||||
-rw-r--r-- | data/even/en.toml | 47 | ||||
-rw-r--r-- | data/even/zh-CN.toml | 47 | ||||
-rw-r--r-- | exampleSite/data/even/default.toml | 47 | ||||
-rw-r--r-- | i18n/en.yaml | 96 | ||||
-rw-r--r-- | i18n/zh-CN.yaml | 96 | ||||
-rw-r--r-- | layouts/_default/section.html | 14 | ||||
-rw-r--r-- | layouts/_default/taxonomy.html | 5 | ||||
-rw-r--r-- | layouts/_default/terms.html | 13 | ||||
-rw-r--r-- | layouts/index.html | 5 | ||||
-rw-r--r-- | layouts/partials/footer.html | 9 | ||||
-rw-r--r-- | layouts/partials/post/copyright.html | 11 | ||||
-rw-r--r-- | layouts/partials/post/reward.html | 7 | ||||
-rw-r--r-- | layouts/partials/post/toc.html | 2 | ||||
-rw-r--r-- | layouts/post/single.html | 11 | ||||
-rw-r--r-- | layouts/post/summary.html | 7 |
16 files changed, 227 insertions, 237 deletions
diff --git a/data/even/default.toml b/data/even/default.toml deleted file mode 100644 index e87bd7c..0000000 --- a/data/even/default.toml +++ /dev/null @@ -1,47 +0,0 @@ -archive = "归档" -tags = "标签" -categories = "分类" - -[footer] - powered = "由 %s 强力驱动" - theme = "主题" - -[posts] - prev = "上一页" - next = "下一页" - prev_post = "上一篇" - next_post = "下一篇" - toc = "文章目录" - readmore = "阅读更多" - reward = "赞赏支持" - rewardAlipay = "支付宝打赏" - rewardWechat = "微信打赏" - seeMarkDown = "查看本文 Markdown 版本 »" - - [posts.header] - wordCount = "约 %d 字" - readingTime = "预计阅读 %d 分钟" - -[copyright] - author = "文章作者" - lastMod = "上次更新" - markdown = "原始文档" - license = "许可协议" - -[counter] - [counter.archives] - zero = "暂无文章" - other = "共计 %d 篇文章" - - [counter.tagcloud] - zero = "暂无标签" - other = "共计 %d 个标签" - - [counter.categories] - zero = "暂无分类" - other = "共计 %d 个分类" - -[traffic] - siteUV = "本站总访客数 %s 人" - sitePV = "本站总访问量 %s 次" - pagePV = "%s 次阅读" diff --git a/data/even/en.toml b/data/even/en.toml deleted file mode 100644 index 09cb578..0000000 --- a/data/even/en.toml +++ /dev/null @@ -1,47 +0,0 @@ -archive = "Archive" -tags = "Tags" -categories = "Categories" - -[footer] - powered = "Powered by %s" - theme = "Theme" - -[posts] - prev = "Prev" - next = "Next" - prev_post = "Prev" - next_post = "Next" - toc = "Contents" - readmore = "Read more.." - reward = "Reward" - rewardAlipay = "alipay" - rewardWechat = "wechat" - seeMarkDown = "The Markdown version »" - - [posts.header] - wordCount = "%d word" - readingTime = "%d min read" - -[copyright] - author = "Author" - lastMod = "LastMod" - markdown = "Markdown" - license = "License" - -[counter] - [counter.archives] - zero = "No Posts" - other = "%d Posts In Total" - - [counter.tagcloud] - zero = "No tags" - other = "%d Tags In Total" - - [counter.categories] - zero = "No Categories" - other = "%d Categories In Total" - -[traffic] - siteUV = "site uv: %s" - sitePV = "site pv: %s" - pagePV = "%s times read" diff --git a/data/even/zh-CN.toml b/data/even/zh-CN.toml deleted file mode 100644 index e87bd7c..0000000 --- a/data/even/zh-CN.toml +++ /dev/null @@ -1,47 +0,0 @@ -archive = "归档" -tags = "标签" -categories = "分类" - -[footer] - powered = "由 %s 强力驱动" - theme = "主题" - -[posts] - prev = "上一页" - next = "下一页" - prev_post = "上一篇" - next_post = "下一篇" - toc = "文章目录" - readmore = "阅读更多" - reward = "赞赏支持" - rewardAlipay = "支付宝打赏" - rewardWechat = "微信打赏" - seeMarkDown = "查看本文 Markdown 版本 »" - - [posts.header] - wordCount = "约 %d 字" - readingTime = "预计阅读 %d 分钟" - -[copyright] - author = "文章作者" - lastMod = "上次更新" - markdown = "原始文档" - license = "许可协议" - -[counter] - [counter.archives] - zero = "暂无文章" - other = "共计 %d 篇文章" - - [counter.tagcloud] - zero = "暂无标签" - other = "共计 %d 个标签" - - [counter.categories] - zero = "暂无分类" - other = "共计 %d 个分类" - -[traffic] - siteUV = "本站总访客数 %s 人" - sitePV = "本站总访问量 %s 次" - pagePV = "%s 次阅读" diff --git a/exampleSite/data/even/default.toml b/exampleSite/data/even/default.toml deleted file mode 100644 index 09cb578..0000000 --- a/exampleSite/data/even/default.toml +++ /dev/null @@ -1,47 +0,0 @@ -archive = "Archive" -tags = "Tags" -categories = "Categories" - -[footer] - powered = "Powered by %s" - theme = "Theme" - -[posts] - prev = "Prev" - next = "Next" - prev_post = "Prev" - next_post = "Next" - toc = "Contents" - readmore = "Read more.." - reward = "Reward" - rewardAlipay = "alipay" - rewardWechat = "wechat" - seeMarkDown = "The Markdown version »" - - [posts.header] - wordCount = "%d word" - readingTime = "%d min read" - -[copyright] - author = "Author" - lastMod = "LastMod" - markdown = "Markdown" - license = "License" - -[counter] - [counter.archives] - zero = "No Posts" - other = "%d Posts In Total" - - [counter.tagcloud] - zero = "No tags" - other = "%d Tags In Total" - - [counter.categories] - zero = "No Categories" - other = "%d Categories In Total" - -[traffic] - siteUV = "site uv: %s" - sitePV = "site pv: %s" - pagePV = "%s times read" diff --git a/i18n/en.yaml b/i18n/en.yaml new file mode 100644 index 0000000..7420827 --- /dev/null +++ b/i18n/en.yaml @@ -0,0 +1,96 @@ +# ===== title ===== +archive: + other: "Archive" + +tags: + other: "Tags" + +categories: + other: "Categories" + +# ===== footer ===== +powered: + other: "Powered by %s" + +theme: + other: "Theme" + +siteUV: + other: "site uv: %s" + +sitePV: + other: "site pv: %s" + +pagePV: + other: "%s times read" + +# ===== post ===== +prevPage: + other: "Prev" + +nextPage: + other: "Next" + +prevPost: + other: "Prev" + +nextPost: + other: "Next" + +toc: + other: "Contents" + +readMore: + other: "Read more.." + +reward: + other: "Reward" + +rewardAlipay: + other: "alipay" + +rewardWechat: + other: "wechat" + +wordCount: + one: "{{ .Count }} word" + other: "{{ .Count }} words" + +readingTime: + one: "{{ .Count }} min read" + other: "{{ .Count }} mins read" + +# ===== content license ===== +author: + other: "Author" + +lastMod: + other: "LastMod" + +markdown: + other: "Markdown" + +seeMarkDown: + other: "The Markdown version »" + +license: + other: "License" + +# ===== counter ===== +archiveCounter: + one: "{{ .Count }} Post In Total" + other: "{{ .Count }} Posts In Total" + +tagCounter: + one: "{{ .Count }} Tag In Total" + other: "{{ .Count }} Tags In Total" + +zeroTagCounter: + other: "No tags" + +categoryCounter: + one: "{{ .Count }} Category In Total" + other: "{{ .Count }} Categories In Total" + +zeroCategoryCounter: + other: "No categories" diff --git a/i18n/zh-CN.yaml b/i18n/zh-CN.yaml new file mode 100644 index 0000000..2d064f0 --- /dev/null +++ b/i18n/zh-CN.yaml @@ -0,0 +1,96 @@ +# ===== title ===== +archive: + other: "归档" + +tags: + other: "标签" + +categories: + other: "分类" + +# ===== footer ===== +powered: + other: "由 %s 强力驱动" + +theme: + other: "主题" + +siteUV: + other: "本站总访客数 %s 人" + +sitePV: + other: "本站总访问量 %s 次" + +pagePV: + other: "%s 次阅读" + +# ===== post ===== +prevPage: + other: "上一页" + +nextPage: + other: "下一页" + +prevPost: + other: "上一篇" + +nextPost: + other: "下一篇" + +toc: + other: "文章目录" + +readMore: + other: "阅读更多" + +reward: + other: "赞赏支持" + +rewardAlipay: + other: "支付宝打赏" + +rewardWechat: + other: "微信打赏" + +wordCount: + one: "约 {{ .Count }} 字" + other: "约 {{ .Count }} 字" + +readingTime: + one: "预计阅读 {{ .Count }} 分钟" + other: "预计阅读 {{ .Count }} 分钟" + +# ===== content license ===== +author: + other: "文章作者" + +lastMod: + other: "上次更新" + +markdown: + other: "原始文档" + +seeMarkDown: + other: "查看本文 Markdown 版本 »" + +license: + other: "许可协议" + +# ===== counter ===== +archiveCounter: + one: "共计 {{ .Count }} 篇文章" + other: "共计 {{ .Count }} 篇文章" + +tagCounter: + one: "共计 {{ .Count }} 个标签" + other: "共计 {{ .Count }} 个标签" + +zeroTagCounter: + other: "暂无标签" + +categoryCounter: + one: "共计 {{ .Count }} 个分类" + other: "共计 {{ .Count }} 个分类" + +zeroCategoryCounter: + other: "暂无分类" diff --git a/layouts/_default/section.html b/layouts/_default/section.html index 029226c..8e5edf1 100644 --- a/layouts/_default/section.html +++ b/layouts/_default/section.html @@ -1,18 +1,12 @@ -{{ define "title" }}{{ .Site.Data.even.default.archive }} - {{ .Site.Title }}{{ end }} +{{ define "title" }}{{ T "archive" }} - {{ .Site.Title }}{{ end }} {{ define "content"}} -{{- $lang := .Site.Data.even.default }} {{- $paginator := .Paginate (where .Data.Pages.ByDate.Reverse "Type" "post") (index .Site.Params "archive-paginate") }} <section id="archive" class="archive"> {{- if not $paginator.HasPrev }} <div class="archive-title"> <span class="archive-post-counter"> - {{- $length := len .Data.Pages }} - {{- if eq $length 0 }} - {{ $lang.counter.archives.zero }} - {{ else }} - {{ printf $lang.counter.archives.other $length }} - {{ end -}} + {{ T "archiveCounter" (len .Data.Pages) }} </span> </div> {{- end -}} @@ -43,12 +37,12 @@ {{ with $paginator.Prev -}} <a class="prev" href="{{ .URL }}"> <i class="iconfont icon-left"></i> - <span class="prev-text">{{ $lang.posts.prev }}</span> + <span class="prev-text">{{ T "prevPage" }}</span> </a> {{- end }} {{ with $paginator.Next -}} <a class="next" href="{{ .URL }}"> - <span class="next-text">{{ $lang.posts.next }}</span> + <span class="next-text">{{ T "nextPage" }}</span> <i class="iconfont icon-right"></i> </a> {{- end }} diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html index ec8a266..b373c7a 100644 --- a/layouts/_default/taxonomy.html +++ b/layouts/_default/taxonomy.html @@ -30,16 +30,15 @@ </section> <!-- pagination --> <nav class="pagination"> - {{- $lang := .Site.Data.even.default -}} {{ with $paginator.Prev }} <a class="prev" href="{{ .URL }}"> <i class="iconfont icon-left"></i> - <span class="prev-text">{{ $lang.posts.prev }}</span> + <span class="prev-text">{{ T "prevPage" }}</span> </a> {{- end }} {{ with $paginator.Next }} <a class="next" href="{{ .URL }}"> - <span class="next-text">{{ $lang.posts.next }}</span> + <span class="next-text">{{ T "nextPage" }}</span> <i class="iconfont icon-right"></i> </a> {{- end }} diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html index 7bdafb9..04b98f8 100644 --- a/layouts/_default/terms.html +++ b/layouts/_default/terms.html @@ -1,7 +1,6 @@ -{{ define "title" }}{{ index .Site.Data.even.default .Data.Plural }} - {{ .Site.Title }}{{ end }} +{{ define "title" }}{{ T .Data.Plural }} - {{ .Site.Title }}{{ end }} {{ define "content" }} - {{ $lang := .Site.Data.even.default -}} {{ $name := .Data.Plural -}} {{ $terms := .Data.Terms.ByCount -}} {{ $length := len $terms -}} @@ -9,9 +8,9 @@ <div class="categories"> <div class="categories-title"> {{ if eq $length 0 }} - {{ $lang.counter.categories.zero }} + {{ T "zeroCategoryCounter" }} {{ else }} - {{ printf $lang.counter.categories.other $length }} + {{ T "categoryCounter" $length }} {{ end }} </div> <div class="categories-tags"> @@ -26,10 +25,10 @@ {{ else if eq $name "tags" }} <div class="tag-cloud"> <div class="tag-cloud-title"> - {{ if eq $length 0 }} - {{ $lang.counter.tagcloud.zero }} + {{ if eq $length 0 }} + {{ T "zeroTagCounter" }} {{ else }} - {{ printf $lang.counter.tagcloud.other $length}} + {{ T "tagCounter" $length }} {{ end }} </div> <div class="tag-cloud-tags"> diff --git a/layouts/index.html b/layouts/index.html index 1a16497..616afdb 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -8,16 +8,15 @@ </section> <!-- pagination --> <nav class="pagination"> - {{- $lang := .Site.Data.even.default -}} {{ with $paginator.Prev }} <a class="prev" href="{{ .URL }}"> <i class="iconfont icon-left"></i> - <span class="prev-text">{{ $lang.posts.prev }}</span> + <span class="prev-text">{{ T "prevPage" }}</span> </a> {{- end }} {{ with $paginator.Next }} <a class="next" href="{{ .URL }}"> - <span class="next-text">{{ $lang.posts.next }}</span> + <span class="next-text">{{ T "nextPage" }}</span> <i class="iconfont icon-right"></i> </a> {{- end }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 287c65c..b6a1fa5 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,4 +1,3 @@ -{{ $lang := .Site.Data.even.default -}} <div class="social-links"> {{- range $name, $path := .Site.Params.social }} {{- if $path }} @@ -15,11 +14,11 @@ <div class="copyright"> <span class="power-by"> - {{ (printf $lang.footer.powered `<a class="hexo-link" href="https://gohugo.io">Hugo</a>`) | safeHTML }} + {{ (printf (T "powered") `<a class="hexo-link" href="https://gohugo.io">Hugo</a>`) | safeHTML }} </span> <span class="division">|</span> <span class="theme-info"> - {{ $lang.footer.theme }} - + {{ T "theme" }} - <a class="theme-link" href="https://github.com/olOwOlo/hugo-theme-even">Even</a> </span> @@ -28,12 +27,12 @@ {{ $spinner := "img/spinner.svg" | relURL -}} {{ if and .Site.Params.busuanzi.enable .Site.Params.busuanzi.sitePV -}} {{ $valueSpan := printf `<span id="busuanzi_value_site_pv"><img src="%s" alt="spinner.svg"/></span>` $spinner -}} - <span id="busuanzi_container_site_pv"> {{ printf $lang.traffic.sitePV $valueSpan | safeHTML }} </span> + <span id="busuanzi_container_site_pv"> {{ printf (T "sitePV") $valueSpan | safeHTML }} </span> {{ if .Site.Params.busuanzi.siteUV }}<span class="division">|</span>{{ end }} {{- end }} {{ if and .Site.Params.busuanzi.enable .Site.Params.busuanzi.siteUV -}} {{ $valueSpan := printf `<span id="busuanzi_value_site_uv"><img src="%s" alt="spinner.svg"/></span>` $spinner -}} - <span id="busuanzi_container_site_uv"> {{ printf $lang.traffic.siteUV $valueSpan | safeHTML }} </span> + <span id="busuanzi_container_site_uv"> {{ printf (T "siteUV") $valueSpan | safeHTML }} </span> {{- end }} </div> {{- end }} diff --git a/layouts/partials/post/copyright.html b/layouts/partials/post/copyright.html index 8a8a350..71494d0 100644 --- a/layouts/partials/post/copyright.html +++ b/layouts/partials/post/copyright.html @@ -1,24 +1,23 @@ {{ if or .Params.contentCopyright (and .Site.Params.contentCopyright (ne .Params.contentCopyright false)) }} -{{ $lang := .Site.Data.even.default -}} <div class="post-copyright"> <p class="copyright-item"> - <span class="item-title">{{ $lang.copyright.author }}</span> + <span class="item-title">{{ T "author" }}</span> <span class="item-content">{{ if .Params.author }}{{ .Params.author | safeHTML }}{{ else }}{{ .Site.Author.name | safeHTML }}{{ end }}</span> </p> <p class="copyright-item"> - <span class="item-title">{{ $lang.copyright.lastMod }}</span> + <span class="item-title">{{ T "lastMod" }}</span> <span class="item-content">{{ .Lastmod.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }}</span> </p> {{ if $.Site.Params.linkToMarkDown -}} {{ with $.OutputFormats.Get "markdown" -}} <p class="copyright-item"> - <span class="item-title">{{ $lang.copyright.markdown }}</span> - <span class="item-content"><a class="link-to-markdown" href="{{ .Permalink }}" target="_blank">{{ $lang.posts.seeMarkDown }}</a></span> + <span class="item-title">{{ T "markdown" }}</span> + <span class="item-content"><a class="link-to-markdown" href="{{ .Permalink }}" target="_blank">{{ T "seeMarkDown" }}</a></span> </p> {{- end }} {{- end }} <p class="copyright-item"> - <span class="item-title">{{ $lang.copyright.license }}</span> + <span class="item-title">{{ T "license" }}</span> <span class="item-content"> {{- if .Params.contentCopyright -}} {{ .Params.contentCopyright | safeHTML }} diff --git a/layouts/partials/post/reward.html b/layouts/partials/post/reward.html index 35933ea..3242854 100644 --- a/layouts/partials/post/reward.html +++ b/layouts/partials/post/reward.html @@ -1,20 +1,19 @@ {{ if or .Params.reward (and .Site.Params.reward.enable (ne .Params.reward false)) }} <div class="post-reward"> - {{- $lang := .Site.Data.even.default }} <input type="checkbox" name="reward" id="reward" hidden /> - <label class="reward-button" for="reward">{{ $lang.posts.reward }}</label> + <label class="reward-button" for="reward">{{ T "reward" }}</label> <div class="qr-code"> {{ $qrCode := .Site.Params.reward }} {{ with $qrCode.wechat }} <label class="qr-code-image" for="reward"> <img class="image" src="{{ . }}"> - <span>{{ $lang.posts.rewardWechat }}</span> + <span>{{ T "rewardWechat" }}</span> </label> {{- end }} {{ with $qrCode.alipay }} <label class="qr-code-image" for="reward"> <img class="image" src="{{ . }}"> - <span>{{ $lang.posts.rewardAlipay }}</span> + <span>{{ T "rewardAlipay" }}</span> </label> {{- end }} </div> diff --git a/layouts/partials/post/toc.html b/layouts/partials/post/toc.html index e5985c9..4fed1c7 100644 --- a/layouts/partials/post/toc.html +++ b/layouts/partials/post/toc.html @@ -1,6 +1,6 @@ {{ if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) }} <div class="post-toc" id="post-toc"> - <h2 class="post-toc-title">{{ .Site.Data.even.default.posts.toc }}</h2> + <h2 class="post-toc-title">{{ T "toc" }}</h2> {{ $globalAutoCollapseToc := .Site.Params.autoCollapseToc | default false }} <div class="post-toc-content{{ if not (or .Params.autoCollapseToc (and $globalAutoCollapseToc (ne .Params.autoCollapseToc false))) }} always-active{{ end }}"> {{.TableOfContents}} diff --git a/layouts/post/single.html b/layouts/post/single.html index 58434b6..e157a81 100644 --- a/layouts/post/single.html +++ b/layouts/post/single.html @@ -1,5 +1,4 @@ {{ define "content" -}} - {{ $lang := .Site.Data.even.default -}} <article class="post"> <!-- post-header --> <header class="post-header"> @@ -15,12 +14,12 @@ </div> {{- end }} {{ if .Site.Params.moreMeta -}} - <span class="more-meta"> {{ printf $lang.posts.header.wordCount .WordCount }} </span> - <span class="more-meta"> {{ printf $lang.posts.header.readingTime .ReadingTime }} </span> + <span class="more-meta"> {{ T "wordCount" .WordCount }} </span> + <span class="more-meta"> {{ T "readingTime" .ReadingTime }} </span> {{- end }} {{ if and .Site.Params.busuanzi.enable .Site.Params.busuanzi.pagePV -}} {{ $valueSpan := printf `<span id="busuanzi_value_page_pv"><img src="%s" alt="spinner.svg"/></span>` ("img/spinner.svg" | relURL) -}} - <span id="busuanzi_container_page_pv" class="more-meta"> {{ printf $lang.traffic.pagePV $valueSpan | safeHTML }} </span> + <span id="busuanzi_container_page_pv" class="more-meta"> {{ printf (T "pagePV") $valueSpan | safeHTML }} </span> {{- end }} </div> </header> @@ -54,13 +53,13 @@ <a class="prev" href="{{ .URL }}"> <i class="iconfont icon-left"></i> <span class="prev-text nav-default">{{ .Title }}</span> - <span class="prev-text nav-mobile">{{ $lang.posts.prev_post }}</span> + <span class="prev-text nav-mobile">{{ T "prevPost" }}</span> </a> {{- end }} {{ with .PrevInSection }} <a class="next" href="{{ .URL }}"> <span class="next-text nav-default">{{ .Title }}</span> - <span class="prev-text nav-mobile">{{ $lang.posts.next_post }}</span> + <span class="prev-text nav-mobile">{{ T "nextPost" }}</span> <i class="iconfont icon-right"></i> </a> {{- end }} diff --git a/layouts/post/summary.html b/layouts/post/summary.html index 0695eac..6069ca1 100644 --- a/layouts/post/summary.html +++ b/layouts/post/summary.html @@ -1,4 +1,3 @@ -{{ $lang := .Site.Data.even.default -}} <article class="post"> <header class="post-header"> <h1 class="post-title"><a class="post-link" href="{{ .URL }}">{{ .Title }}</a></h1> @@ -12,8 +11,8 @@ </div> {{- end }} {{ if .Site.Params.moreMeta -}} - <span class="more-meta"> {{ printf $lang.posts.header.wordCount .WordCount }} </span> - <span class="more-meta"> {{ printf $lang.posts.header.readingTime .ReadingTime }} </span> + <span class="more-meta"> {{ T "wordCount" .WordCount }} </span> + <span class="more-meta"> {{ T "readingTime" .ReadingTime }} </span> {{- end }} </div> </header> @@ -23,7 +22,7 @@ {{ .Summary }} </div> <div class="read-more"> - <a href="{{ .URL }}" class="read-more-link">{{ $lang.posts.readmore }}</a> + <a href="{{ .URL }}" class="read-more-link">{{ T "readMore" }}</a> </div> </div> </article> |