From 69aa0cd779203599a3db1cb05845e8a7b6c71357 Mon Sep 17 00:00:00 2001 From: Dillon ZENG Date: Sat, 23 Nov 2019 13:42:26 +0800 Subject: [PATCH] fix(i18n): fix Valine Comment System i18n bug --- i18n/en.toml | 5 ++++ i18n/zh.toml | 5 ++++ images/Apple-Devices-Preview.png | Bin 230071 -> 230508 bytes layouts/partials/comments.html | 5 ++-- layouts/partials/paginator.html | 43 ++++++++++++++----------------- 5 files changed, 31 insertions(+), 27 deletions(-) diff --git a/i18n/en.toml b/i18n/en.toml index ef58201b..72c6641f 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -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" diff --git a/i18n/zh.toml b/i18n/zh.toml index b013145b..6eba84b5 100644 --- a/i18n/zh.toml +++ b/i18n/zh.toml @@ -28,6 +28,11 @@ other = "分类" other = "更多" # === Pagination === +# === partials/comments.html === +[valineLang] +other = "zh-cn" +# === partials/comments.html === + # === partials/footer.html === [powered] other = "由 %s 强力驱动" diff --git a/images/Apple-Devices-Preview.png b/images/Apple-Devices-Preview.png index d1bd34c90ae7fc54563fa50a54ae98288e45b25d..0e1638895bc11b14e60dd964e71d73f4b124db0e 100644 GIT binary patch delta 460 zcmY*V%SyvQ6unJFq>C>6f?)&&p);9Qg$_wnEP~LWh>LWYwy6e9Qj?LyRZ*zA^b`6M z;$Hk5Kf*idL!4R6nKS2}bMJgk>pySx_tpeDfp<1?UDySH4KOO3P(@V14X+`rl^9?f zPXJ?PESdGAS#^oE2;lhe{u>K>;gzR6w<`xp#Qb5>4_Fb6ONCWPgi)Y;Qbc!gCJTE) zONqpb<~b#$M%~)fb1%qAk_Kd-?J<)&HA0A$4oC8`bGoRfvN)_$v-s-goLcv5 Rr}reLqB0f6hp4_h{{oQze9iy> delta 25 ecmaFU!MDAYZ-R023&!>rj3CUk{RJa)OA`Q*m + {{ end }} {{- end -}} diff --git a/layouts/partials/paginator.html b/layouts/partials/paginator.html index 3e9da84a..6b23e313 100644 --- a/layouts/partials/paginator.html +++ b/layouts/partials/paginator.html @@ -1,31 +1,26 @@ -{{ $pag := $.Paginator }} - -{{ if gt $pag.TotalPages 1 }} +{{ if gt $.paginator.TotalPages 1 -}}
    - {{ 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 }} -
  • + {{- $.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 -}} +
  • {{ .PageNumber }}
  • - {{ else if ($.Scratch.Get "__paginator.shouldEllipse") }} + {{- else if ($.Scratch.Get "paginator.shouldEllipse") -}}
  • - {{ end }} - {{ end }} + {{ end -}} + {{ end -}}
-{{ end }} \ No newline at end of file +{{- end }} \ No newline at end of file