From 6b9fdd9482f62eb820f7c03ba50ef25dc6823295 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Thu, 25 Feb 2021 18:14:21 +0000 Subject: [PATCH] feat: enable Wowchemy attribution to be translated Add EN and ZH translations. See https://github.com/wowchemy/wowchemy-hugo-modules/discussions/2161 --- wowchemy/i18n/en.yaml | 7 ++++++- wowchemy/i18n/zh-Hant.yaml | 5 +++++ wowchemy/i18n/zh.yaml | 5 +++++ wowchemy/layouts/partials/site_footer.html | 14 ++++++++++---- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/wowchemy/i18n/en.yaml b/wowchemy/i18n/en.yaml index 72db42f6..601916dc 100644 --- a/wowchemy/i18n/en.yaml +++ b/wowchemy/i18n/en.yaml @@ -216,7 +216,7 @@ - id: slides translation: Slides - + - id: authors translation: Authors @@ -255,3 +255,8 @@ - id: cookie_learn translation: Learn more + +# Published with + +- id: published_with + translation: Published with {wowchemy} — the free, {repo_link}open source{/repo_link} website builder that empowers creators. diff --git a/wowchemy/i18n/zh-Hant.yaml b/wowchemy/i18n/zh-Hant.yaml index 920cae61..ede2f7f1 100644 --- a/wowchemy/i18n/zh-Hant.yaml +++ b/wowchemy/i18n/zh-Hant.yaml @@ -223,3 +223,8 @@ - id: cookie_learn translation: 了解更多 + +# Published with + +- id: published_with + translation: 由{wowchemy}支持发布——免费{repo_link}开源{/repo_link}网站,为创作者赋能。 diff --git a/wowchemy/i18n/zh.yaml b/wowchemy/i18n/zh.yaml index 2bf4190e..3a2bc932 100644 --- a/wowchemy/i18n/zh.yaml +++ b/wowchemy/i18n/zh.yaml @@ -234,3 +234,8 @@ - id: cookie_learn translation: 了解更多 + +# Published with + +- id: published_with + translation: 由{wowchemy}支持发布——免费{repo_link}开源{/repo_link}网站,为创作者赋能。 diff --git a/wowchemy/layouts/partials/site_footer.html b/wowchemy/layouts/partials/site_footer.html index 468cc3a5..2af3e278 100644 --- a/wowchemy/layouts/partials/site_footer.html +++ b/wowchemy/layouts/partials/site_footer.html @@ -22,10 +22,16 @@ {{ $is_sponsor := site.Params.i_am_a_sponsor | default false }} {{ $hide_published_with_footer := site.Params.power_ups.hide_published_with | default true }} {{ if not (and $is_sponsor $hide_published_with_footer) }} - Published with - Wowchemy — - the free, - open source website builder that empowers creators. + {{ $default := "Published with {wowchemy} — the free, {repo_link}open source{/repo_link} website builder that empowers creators." }} + {{ $i18n_published_with := i18n "published_with" | default $default }} + {{ if not (findRE "{wowchemy}" $i18n_published_with) }} + {{ warnf "Please attribute Wowchemy using `{wowchemy}` in the `published_with` text." }} + {{ $i18n_published_with = $default }} + {{ end }} + {{ $i18n_published_with = replace $i18n_published_with "{wowchemy}" "Wowchemy" | safeHTML }} + {{ $i18n_published_with = replace $i18n_published_with "{repo_link}" "" | safeHTML }} + {{ $i18n_published_with = replace $i18n_published_with "{/repo_link}" "" | safeHTML }} + {{ $i18n_published_with | markdownify | emojify }} {{ end }}