From c7cfb9c844a715f4101e690cc357e0d766d8968b Mon Sep 17 00:00:00 2001 From: BBaoVanC Date: Mon, 11 Oct 2021 18:24:14 -0500 Subject: [PATCH] Support multilingual mode (experimental) Please report any bugs! --- data/meses.toml | 12 +++++++++++ i18n/en.toml | 31 +++++++++++++++++++++++++++++ i18n/es.toml | 31 +++++++++++++++++++++++++++++ layouts/_default/baseof.html | 2 +- layouts/_default/list.html | 4 ++-- layouts/_default/single.html | 2 +- layouts/_default/summary.html | 2 +- layouts/partials/credit.html | 2 +- layouts/partials/post-metadata.html | 10 +++++----- layouts/partials/top.html | 2 +- layouts/robots.txt | 2 +- layouts/shortcodes/video.html | 2 +- 12 files changed, 88 insertions(+), 14 deletions(-) create mode 100644 data/meses.toml create mode 100644 i18n/en.toml create mode 100644 i18n/es.toml diff --git a/data/meses.toml b/data/meses.toml new file mode 100644 index 0000000..5a4ace9 --- /dev/null +++ b/data/meses.toml @@ -0,0 +1,12 @@ +1 = "enero" +2 = "febrero" +3 = "marzo" +4 = "abril" +5 = "mayo" +6 = "julio" +7 = "junio" +8 = "agosto" +9 = "septiembre" +10 = "octubre" +11 = "noviembre" +12 = "diciembre" diff --git a/i18n/en.toml b/i18n/en.toml new file mode 100644 index 0000000..3087eb6 --- /dev/null +++ b/i18n/en.toml @@ -0,0 +1,31 @@ +[credit_comment] + other = "" + +[long_date] + other = "{{ .Date.Format `January 2, 2006` }}" + +[wordcount] + one = "{{ . }} word" + other = "{{ . }} words" + +[readingtime] + one = "{{ . }} min" + other = "{{ . }} mins" + +[read_more] + other = "Read more" + + +[browser_no_video_support] + other = "Your browser does not support video." + + +[filtering_for] + other = "Filtering for \"{{ . }}\"" + +[no_posts] + other = "No posts here!" + + +[table_of_contents] + other = "Table of Contents" diff --git a/i18n/es.toml b/i18n/es.toml new file mode 100644 index 0000000..d63a576 --- /dev/null +++ b/i18n/es.toml @@ -0,0 +1,31 @@ +[credit_comment] + other = "" + +[long_date] + other = "{{ .Date.Day }} de {{ index .Data.meses (printf `%d` .Date.Month) }} de {{ .Date.Year }}" + +[wordcount] + one = "{{ . }} palabra" + other = "{{ . }} palabras" + +[readingtime] + one = "{{ . }} min" + other = "{{ . }} mins" + +[read_more] + other = "Leer más" + + +[browser_no_video_support] + other = "Tu navegador de internet no admite video." + + +[filtering_for] + other = "Filtrando por \"{{ . }}\"" + +[no_posts] + other = "¡No páginas aquí!" + + +[table_of_contents] + other = "Índice" diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 323b449..07e31e9 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,6 +1,6 @@ {{ partialCached "credit.html" . }} - + {{- partial "head.html" . -}} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 000fc89..0a416a9 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -2,7 +2,7 @@ {{ if or (eq .Kind "term") (eq .Kind "taxonomy") }}

{{ partialCached "icon.html" "filter" "filter" }} - Filtering for "{{ .Title }}" + {{ i18n "filtering_for" .Title }} {{ if eq .Kind "term" }} {{ with .OutputFormats.Get "rss" }} @@ -37,7 +37,7 @@ {{ .Render "summary" }} {{ else }}
- No posts here! + {{ i18n "no_posts" }}
{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 441d2c8..a99b41c 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -10,7 +10,7 @@ {{ if .Params.Toc }}
-

Table of Contents

+

{{ i18n "table_of_contents" }}

{{ .TableOfContents }}
{{ end }} diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html index 741e4cf..078be8d 100644 --- a/layouts/_default/summary.html +++ b/layouts/_default/summary.html @@ -32,6 +32,6 @@ diff --git a/layouts/partials/credit.html b/layouts/partials/credit.html index 560c5f6..e2f8ac1 100644 --- a/layouts/partials/credit.html +++ b/layouts/partials/credit.html @@ -1 +1 @@ -{{ "" | safeHTML }} +{{ i18n "credit_comment" | safeHTML }} diff --git a/layouts/partials/post-metadata.html b/layouts/partials/post-metadata.html index 8c73332..3d1718b 100644 --- a/layouts/partials/post-metadata.html +++ b/layouts/partials/post-metadata.html @@ -4,7 +4,7 @@ @@ -13,7 +13,7 @@ @@ -23,14 +23,14 @@ {{ if .Site.Params.wordcount }} {{ end }} {{ if .Site.Params.readingtime }} {{ end }} @@ -38,7 +38,7 @@ {{ with .GitInfo }} diff --git a/layouts/partials/top.html b/layouts/partials/top.html index 14d02cb..1e57690 100644 --- a/layouts/partials/top.html +++ b/layouts/partials/top.html @@ -3,7 +3,7 @@