Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
feat(i18n): add switchTheme i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonzq committed Jan 30, 2020
1 parent 78ef3fa commit 7e62363
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 19 deletions.
9 changes: 7 additions & 2 deletions i18n/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@ other = "Categories"
# === Taxonomy ===

# === Pagination ===
[More]
[more]
other = "More"
# === Pagination ===

# === partials/header.html ===
[switchTheme]
other = "Switch Theme"
# === partials/header.html ===

# === partials/comments.html ===
[valineLang]
other = "en"
Expand Down Expand Up @@ -75,7 +80,7 @@ other = "Back"
[home]
other = "Home"

[readmore]
[readMore]
other = "Read More"

[day]
Expand Down
9 changes: 7 additions & 2 deletions i18n/zh.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@ other = "分类"
# === Taxonomy ===

# === Pagination ===
[More]
[more]
other = "更多"
# === Pagination ===

# === partials/header.html ===
[switchTheme]
other = "切换主题"
# === partials/header.html ===

# === partials/comments.html ===
[valineLang]
other = "zh-cn"
Expand Down Expand Up @@ -78,7 +83,7 @@ other = "返回"
[home]
other = "主页"

[readmore]
[readMore]
other = "阅读全文"

[day]
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h1 class="post-title post-list-title" itemprop="name headline">
{{ end }}
</div>
<div class="post-footer">
<a href="{{ .Permalink }}">{{ T "readmore" }}</a>
<a href="{{ .Permalink }}">{{ T "readMore" }}</a>
{{ with .Params.tags }}
<div class="post-tags">
{{ range . }}
Expand Down
20 changes: 10 additions & 10 deletions layouts/partials/comments.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
<!-- gitalk Comment System-->
{{- if .Site.Params.gitalk.owner -}}
<div id="gitalk-container"></div>
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.gitalk_css }}
{{ if .Site.Params.cdn.gitalk_css }}
{{ .Site.Params.cdn.gitalk_css | safeHTML }}
{{ else }}
{{- $res := resources.Get "css/lib/gitalk/gitalk.css" | resources.Minify -}}
<link rel="stylesheet" href="{{ $res.RelPermalink }}">
{{ end }}
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.gitalk_js }}
{{ if .Site.Params.cdn.gitalk_js }}
{{ .Site.Params.cdn.gitalk_js | safeHTML }}
{{ else }}
{{- $res := resources.Get "js/lib/gitalk/gitalk.min.js" | resources.Minify -}}
Expand All @@ -53,7 +53,7 @@
<!-- valine -->
{{- if .Site.Params.valine.enable -}}
<div id="vcomments"></div>
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.valine_js }}
{{ if .Site.Params.cdn.valine_js }}
{{ .Site.Params.cdn.valine_js | safeHTML }}
{{ else }}
{{- $res := resources.Get "js/lib/valine/Valine.min.js" | resources.Minify -}}
Expand All @@ -79,16 +79,16 @@
<!-- facebook comment -->
{{- if .Site.Params.facebook.enable -}}
<div id="fb-root"></div>
<script
async
defer
crossorigin="anonymous"
<script
async
defer
crossorigin="anonymous"
src="https://connect.facebook.net/{{ .Site.Params.facebook.languageCode }}/sdk.js#xfbml=1&version=v5.0&appId={{ .Site.Params.facebook.appId }}&autoLogAppEvents=1"
></script>
<div
class="fb-comments"
<div
class="fb-comments"
data-href="{{ .Site.Params.baseURL }}{{ .Permalink | absURL }}"
data-width="{{ .Site.Params.facebook.width }}"
data-width="{{ .Site.Params.facebook.width }}"
data-numposts="{{ .Site.Params.facebook.numPosts }}"
></div>
{{- end -}}
Expand Down
7 changes: 4 additions & 3 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
{{ range .Site.Menus.main }}
<a class="menu-item{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) | or (eq $currentPage.RelPermalink .URL) }} active{{ end }}" href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name | safeHTML }}</a>
{{ end }}
<a href="javascript:void(0);" class="theme-switch"><i class="fas fa-adjust fa-rotate-180 fa-fw" title="Switch Theme"></i></a>
<a href="javascript:void(0);" class="theme-switch"><i class="fas fa-adjust fa-rotate-180 fa-fw" title={{ T "switchTheme" }}></i></a>
</div>
</div>
</nav>

<nav class="navbar-mobile">
<div class="navbar-container">
<div class="navbar-container">
<div class="navbar-header">
<div class="navbar-header-title animated bounceIn">
<a href="{{.Site.BaseURL}}">{{ .Site.Title }}</a>
Expand All @@ -27,7 +28,7 @@
{{ range .Site.Menus.main }}
<a class="menu-item" href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name | safeHTML }}</a>
{{ end }}
<a href="javascript:void(0);" class="theme-switch"><i class="fas fa-adjust fa-rotate-180 fa-fw"></i></a>
<a href="javascript:void(0);" class="theme-switch"><i class="fas fa-adjust fa-rotate-180 fa-fw" title={{ T "switchTheme" }}></i></a>
</div>
</div>
</nav>
2 changes: 1 addition & 1 deletion layouts/taxonomy/terms.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h3><i class="far fa-folder fa-fw"></i>{{ $term | humanize}}</h3>
{{ end }}
{{ if gt (len $pages) 5 }}
<span class="more-post">
<a href="{{ .Permalink }}" class="more-post-link">{{ T "More" }} >></a>
<a href="{{ .Permalink }}" class="more-post-link">{{ T "more" }} >></a>
</span>
{{ end }}
</div>
Expand Down

0 comments on commit 7e62363

Please sign in to comment.