diff options
Diffstat (limited to 'layouts')
-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 |
10 files changed, 35 insertions, 49 deletions
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> |