From 76e4b7174a5e510010c6835d8e65a6ae4f0ff2c1 Mon Sep 17 00:00:00 2001 From: Jan Steinke Date: Sat, 23 Feb 2019 14:30:18 +0100 Subject: [PATCH] add i18n translation support (#156) * add initial translation * readd _copy params to templates --- i18n/de.toml | 17 +++++++++++++++++ i18n/en.toml | 17 +++++++++++++++++ layouts/index.html | 6 +++--- layouts/partials/menu-contextual.html | 4 ++-- layouts/partials/summary-with-image.html | 2 +- 5 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 i18n/de.toml create mode 100644 i18n/en.toml diff --git a/i18n/de.toml b/i18n/de.toml new file mode 100644 index 0000000..12d93bf --- /dev/null +++ b/i18n/de.toml @@ -0,0 +1,17 @@ +[more] +other = "Mehr" + +[allTitle] +other = "Alle {{.Title }}" + +[recentTitle] +other = "Neuste {{.Title }}" + +[readMore] +other = "weiterlesen" + +[whatsInThis] +other = "Was ist in dieser {{ .Type }}" + +[related] +other = "Ähnliches" diff --git a/i18n/en.toml b/i18n/en.toml new file mode 100644 index 0000000..97100a4 --- /dev/null +++ b/i18n/en.toml @@ -0,0 +1,17 @@ +[more] +other = "More" + +[allTitle] +other = "All {{.Title }}" + +[recentTitle] +other = "Recent {{.Title }}" + +[readMore] +other = "read more" + +[whatsInThis] +other = "What's in this {{ .Type }}" + +[related] +other = "Related" diff --git a/layouts/index.html b/layouts/index.html index 8ff836d..0361bce 100755 --- a/layouts/index.html +++ b/layouts/index.html @@ -16,7 +16,7 @@ {{/* Use $section_name to get the section title. Use "with" to only show it if it exists */}} {{ with .Site.GetPage "section" $section_name }}

- {{$.Param "recent_copy" | default "Recent" }} {{ .Title }} + {{ $.Param "recent_copy" | default (i18n "recentTitle" .) }}

{{ end }} @@ -33,7 +33,7 @@ {{ if ge $section_count (add $n_posts 1) }}
-

More

+

{{ i18n "more" }}

{{/* Now, range through the next four after the initial $n_posts items. Nest the requirements, "after" then "first" on the outside */}} {{ range (first 4 (after $n_posts $section)) }}

@@ -45,7 +45,7 @@ {{/* As above, Use $section_name to get the section title, and URL. Use "with" to only show it if it exists */}} {{ with .Site.GetPage "section" $section_name }} - All {{.Title }} + {{ i18n "allTitle" . }} {{ end }}

{{ end }} diff --git a/layouts/partials/menu-contextual.html b/layouts/partials/menu-contextual.html index 02fa3ee..93b3952 100644 --- a/layouts/partials/menu-contextual.html +++ b/layouts/partials/menu-contextual.html @@ -5,7 +5,7 @@ {{- if .Params.toc -}} {{- end -}} @@ -19,7 +19,7 @@ {{ with $related }}