From 577e168da5cc527d872fbbe97087a5b54472e173 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Mon, 3 Oct 2016 22:57:27 +0300 Subject: [PATCH] Use i18n to translate some strings Hugo 0.17 allows for easy multi-lingual sites. Strings can be translated either in the theme or in the site, and missing strings will fall back to the default language. See: https://github.com/spf13/hugo/blob/master/docs/content/content/multilingual.md --- i18n/en.yaml | 14 ++++++++++++++ layouts/_default/single.html | 2 +- layouts/_default/summary.html | 2 +- layouts/partials/sharing-icons.html | 2 +- layouts/partials/sidebar.html | 4 ++-- 5 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 i18n/en.yaml diff --git a/i18n/en.yaml b/i18n/en.yaml new file mode 100644 index 0000000..731f426 --- /dev/null +++ b/i18n/en.yaml @@ -0,0 +1,14 @@ +- id: about + translation: "About" + +- id: recentPosts + translation: "Recent Posts" + +- id: readMore + translation: "Read more" + +- id: translations + translation: "Translations" + +- id: share + translation: "Share" diff --git a/layouts/_default/single.html b/layouts/_default/single.html index d269198..3270835 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -8,7 +8,7 @@ {{ .Content }} {{ if .IsTranslated }} -

Translations

+

{{ i18n "translations" }}