fix(i18n): fix Valine Comment System i18n bug

This commit is contained in:
Dillon ZENG 2019-11-23 13:42:26 +08:00
parent 473900da79
commit 69aa0cd779
5 changed files with 31 additions and 27 deletions

View file

@ -28,6 +28,11 @@ other = "Categories"
other = "More"
# === Pagination ===
# === partials/comments.html ===
[valineLang]
other = "en"
# === partials/comments.html ===
# === partials/footer.html ===
[powered]
other = "Powered by %s"

View file

@ -28,6 +28,11 @@ other = "分类"
other = "更多"
# === Pagination ===
# === partials/comments.html ===
[valineLang]
other = "zh-cn"
# === partials/comments.html ===
# === partials/footer.html ===
[powered]
other = "由 %s 强力驱动"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 KiB

After

Width:  |  Height:  |  Size: 225 KiB

View file

@ -57,9 +57,7 @@
{{ .Site.Params.cdn.valine_js | safeHTML }}
{{ else }}
{{- $res := resources.Get "js/lib/valine/Valine.min.js" | resources.Minify -}}
{{ .Site.Params.cdn.fontawesome_free_css | safeHTML }}
{{ .Site.Params.cdn.fontawesome_free_css | safeHTML }}
<script src="{{ $res.RelPermalink }}"></script>
<script src="{{ $res.RelPermalink }}"></script>
{{ end }}
<script type="text/javascript">
new Valine({
@ -73,6 +71,7 @@
placeholder: "{{ .Site.Params.valine.placeholder }}",
visitor: "{{ .Site.Params.valine.visitor }}",
recordIP: "{{ .Site.Params.valine.recordIP }}",
lang: "{{ T `valineLang` }}",
});
</script>
{{- end -}}

View file

@ -1,31 +1,26 @@
{{ $pag := $.Paginator }}
{{ if gt $pag.TotalPages 1 }}
{{ if gt $.paginator.TotalPages 1 -}}
<ul class="pagination">
{{ with $pag.First }}
{{ end }}
{{ $.Scratch.Set "__paginator.ellipsed" false }}
{{ range $pag.Pagers }}
{{ $right := sub .TotalPages .PageNumber }}
{{ $showNumber := or (le .PageNumber 1) (eq $right 0) }}
{{ $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 3)) (lt .PageNumber (add $pag.PageNumber 3))) }}
{{ if $showNumber }}
{{ $.Scratch.Set "__paginator.ellipsed" false }}
{{ $.Scratch.Set "__paginator.shouldEllipse" false }}
{{ else }}
{{ $.Scratch.Set "__paginator.shouldEllipse" (not ($.Scratch.Get "__paginator.ellipsed") ) }}
{{ $.Scratch.Set "__paginator.ellipsed" true }}
{{ end }}
{{ if $showNumber }}
<li class="page-item {{ if eq . $pag }}active{{ end }}">
{{- $.Scratch.Set "paginator.ellipsed" false -}}
{{ range $.paginator.Pagers -}}
{{ $right := sub .TotalPages .PageNumber -}}
{{ $showNumber := or (le .PageNumber 1) (eq $right 0) -}}
{{ $showNumber := or $showNumber (and (gt .PageNumber (sub $.paginator.PageNumber 3)) (lt .PageNumber (add $.paginator.PageNumber 3))) -}}
{{ if $showNumber -}}
{{ $.Scratch.Set "paginator.ellipsed" false -}}
{{ $.Scratch.Set "paginator.shouldEllipse" false -}}
{{ else -}}
{{ $.Scratch.Set "paginator.shouldEllipse" (not ($.Scratch.Get "paginator.ellipsed") ) -}}
{{ $.Scratch.Set "paginator.ellipsed" true -}}
{{ end -}}
{{ if $showNumber -}}
<li class="page-item {{ if eq . $.paginator }}active{{ end }}">
<span class="page-link">
<a href="{{ .URL }}">{{ .PageNumber }}</a>
</span>
</li>
{{ else if ($.Scratch.Get "__paginator.shouldEllipse") }}
{{- else if ($.Scratch.Get "paginator.shouldEllipse") -}}
<li class="page-item "><span class="page-link" aria-hidden="true">&hellip;</span></li>
{{ end }}
{{ end }}
{{ end -}}
{{ end -}}
</ul>
{{ end }}
{{- end }}