From 6b2b8e81e631a1fec44bdb94d5177cf5c56287c9 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sat, 28 May 2022 15:15:11 +0200 Subject: Added multilanguage support --- layouts/404.html | 12 +++--------- layouts/_default/baseof.html | 13 ++++++++----- layouts/_default/home.manifest.webmanifest | 6 ++++-- layouts/_default/list.json.json | 2 +- layouts/_default/teaser.html | 3 +-- layouts/dramas/single.html | 2 +- layouts/narratives/single.html | 2 +- layouts/partials/footer.html | 2 +- layouts/partials/mini-toc.html | 3 +-- layouts/partials/post-meta/date.html | 5 ++--- layouts/partials/post-toc-summary.html | 2 +- layouts/partials/sidebar-toc.html | 5 ++--- layouts/poems/single.html | 2 +- layouts/shortcodes/form-contact.html | 7 +++---- 14 files changed, 30 insertions(+), 36 deletions(-) (limited to 'layouts') diff --git a/layouts/404.html b/layouts/404.html index 5584276..1412779 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -3,17 +3,11 @@

404

-

Page not found

+

{{ i18n "404_title" }}

-

- Sorry, we've misplaced that URL or it's pointing to something - that doesn't exist. -

- -

- Head back home to try finding it again. -

+

{{ i18n "404_description" }}

+

{{ i18n "404_back" }} .


diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 355f674..e05a918 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,21 +1,24 @@ - {{- partial "head.html" . -}} + {{ partial "head.html" . }} - {{ if .Params.toc }}{{ partial "sidebar-toc.html" . }}{{ else }}{{ partial "sidebar.html" . }}{{ end }} + {{ if .Params.toc }} + {{ partial "sidebar-toc.html" . }} + {{ else }} + {{ partial "sidebar.html" . }} + {{ end }}

- {{/* TODO: Translate titlle */}} - {{ site.Title }} + {{ site.Title }}
{{ site.Params.tagline }}

- {{- block "main" . }}{{- end }} + {{ block "main" . }}{{ end }}
diff --git a/layouts/_default/home.manifest.webmanifest b/layouts/_default/home.manifest.webmanifest index 0a84c55..c9437df 100644 --- a/layouts/_default/home.manifest.webmanifest +++ b/layouts/_default/home.manifest.webmanifest @@ -5,8 +5,8 @@ "name": {{ site.Title | htmlUnescape | jsonify }}, {{ with site.Params.tagline }}"short_name": {{ . | htmlUnescape | jsonify }},{{ end }} {{ with site.Params.description }}"description": {{ . | htmlUnescape | jsonify }},{{ end }} - {{ with site.LanguageCode }}"lang": {{ . | jsonify }}, - "dir": "ltr", {{/* TODO: Get dir from lang */}}{{ end }} + "lang": "{{ site.LanguageCode | default site.Language.Lang }}",{{ with partialCached "func/GetLanguageDirection" "GetLanguageDirection" }} + "dir": {{ . | jsonify }},{{ end }} "start_url": "/index.html?homescreen=1", "display": "fullscreen", "theme_color": "#ffffff", @@ -28,3 +28,5 @@ }{{ if ne . 512 }},{{ end }}{{- end }} ] } + + diff --git a/layouts/_default/list.json.json b/layouts/_default/list.json.json index 308bd96..30b6f80 100644 --- a/layouts/_default/list.json.json +++ b/layouts/_default/list.json.json @@ -16,7 +16,7 @@ { "version": "https://jsonfeed.org/version/1.1", - "title": {{ (printf "%s" (partial "title.html" .)) | htmlUnescape | jsonify }},{{/* TODO: Translate title */}} + "title": {{ (printf "%s" (partial "title.html" .)) | htmlUnescape | jsonify }}, "home_page_url": {{ printf "%s?utm_source=json_feed" site.BaseURL | absURL | jsonify }}, {{ with .OutputFormats.Get "JSON" }}"feed_url": {{ .Permalink | absURL | jsonify }},{{ end }} {{ with site.Params.description}}"description": {{ site.Params.description | jsonify }},{{ end }} diff --git a/layouts/_default/teaser.html b/layouts/_default/teaser.html index 8e161c1..8edf8b4 100644 --- a/layouts/_default/teaser.html +++ b/layouts/_default/teaser.html @@ -12,8 +12,7 @@ {{- if site.Params.readmore }} {{- if .Truncated }} {{- end }} {{- end }} diff --git a/layouts/dramas/single.html b/layouts/dramas/single.html index dc31717..865a07b 100644 --- a/layouts/dramas/single.html +++ b/layouts/dramas/single.html @@ -1,7 +1,7 @@ {{ define "main" }}

{{ .Params.caption | default .Title }}

- + {{ with .Params.author }}{{ end }} {{ .Content }}
{{ end }} diff --git a/layouts/narratives/single.html b/layouts/narratives/single.html index 030af43..e3dc1b9 100644 --- a/layouts/narratives/single.html +++ b/layouts/narratives/single.html @@ -1,7 +1,7 @@ {{ define "main" }}

{{ .Params.caption | default .Title }}

- + {{ with .Params.author }}{{ end }} {{ .Content }}
{{ end }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 7525a24..654a7a8 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -7,7 +7,7 @@ {{ end }} {{ with .Params.editor }}

- Edited by {{ . }}, + {{ i18n "edited_by" . }}, {{ if not $.Params.Lastmod.IsZero }} {{ $.Params.Lastmod.Format "2006" }} {{ else }} diff --git a/layouts/partials/mini-toc.html b/layouts/partials/mini-toc.html index 4d4d742..629169b 100644 --- a/layouts/partials/mini-toc.html +++ b/layouts/partials/mini-toc.html @@ -12,8 +12,7 @@ {{ $mxPosts := site.Params.recentPostsSize | default 5 }}