Przeglądaj źródła

feat: enable Wowchemy attribution to be translated

Add EN and ZH translations.

See https://github.com/wowchemy/wowchemy-hugo-modules/discussions/2161
George Cushen 4 lat temu
rodzic
commit
6b9fdd9482

+ 6 - 1
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.

+ 5 - 0
wowchemy/i18n/zh-Hant.yaml

@@ -223,3 +223,8 @@
 
 - id: cookie_learn
   translation: 了解更多
+
+# Published with
+
+- id: published_with
+  translation: 由{wowchemy}支持发布——免费{repo_link}开源{/repo_link}网站,为创作者赋能。

+ 5 - 0
wowchemy/i18n/zh.yaml

@@ -234,3 +234,8 @@
 
 - id: cookie_learn
   translation: 了解更多
+
+# Published with
+
+- id: published_with
+  translation: 由{wowchemy}支持发布——免费{repo_link}开源{/repo_link}网站,为创作者赋能。

+ 10 - 4
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
-    <a href="https://wowchemy.com/?utm_campaign=poweredby" target="_blank" rel="noopener">Wowchemy</a>  —
-    the free, <a href="https://github.com/wowchemy/wowchemy-hugo-modules" target="_blank" rel="noopener">
-    open source</a> 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}" "<a href=\"https://wowchemy.com/?utm_campaign=poweredby\" target=\"_blank\" rel=\"noopener\">Wowchemy</a>" | safeHTML }}
+      {{ $i18n_published_with = replace $i18n_published_with "{repo_link}" "<a href=\"https://github.com/wowchemy/wowchemy-hugo-modules\" target=\"_blank\" rel=\"noopener\">" | safeHTML }}
+      {{ $i18n_published_with = replace $i18n_published_with "{/repo_link}" "</a>" | safeHTML }}
+      {{ $i18n_published_with | markdownify | emojify }}
     {{ end }}
   </p>
 </footer>