From c71cd581170c91ee79c55dd80be0a23cbcd3f144 Mon Sep 17 00:00:00 2001 From: Adrian Friedli Date: Sun, 29 Apr 2018 22:21:54 +0200 Subject: [PATCH] refactor: add separate shortcode for i18n --- content/cfp.de.md | 10 +++++----- content/cfp.en.md | 8 ++++---- content/cfp.fr.md | 8 ++++---- content/cfp.it.md | 8 ++++---- content/infos.de.md | 4 ++-- content/infos.en.md | 4 ++-- content/infos.fr.md | 4 ++-- content/infos.it.md | 6 +++--- content/ort.de.md | 2 +- content/ort.en.md | 2 +- content/ort.fr.md | 2 +- content/ort.it.md | 2 +- layouts/shortcodes/cosin.html | 2 +- layouts/shortcodes/cosin_i18n.html | 2 ++ 14 files changed, 33 insertions(+), 31 deletions(-) create mode 100644 layouts/shortcodes/cosin_i18n.html diff --git a/content/cfp.de.md b/content/cfp.de.md index eac03e3..36ea390 100644 --- a/content/cfp.de.md +++ b/content/cfp.de.md @@ -21,11 +21,11 @@ voneinander zu lernen und Spass zu haben — nicht nur am Gerät. ## Wann und wo findet die CoSin statt? Die CoSin findet dieses Jahr vom -{{< cosin "date_day_name_start" >}}, den {{< cosin "date_day_start" >}}. bis -{{< cosin "date_day_name_end" >}}, den {{< cosin "date_day_end" >}}. -{{< cosin "date_month" >}} {{< cosin "date_year" >}} -{{< cosin "location_name_preposition" >}} [{{< cosin "location_name" >}}]({{< cosin "location_url" >}}) -in {{< cosin "location_city" >}} statt. +{{< cosin_i18n "date_day_name_start" >}}, den {{< cosin "date_day_start" >}}. bis +{{< cosin_i18n "date_day_name_end" >}}, den {{< cosin "date_day_end" >}}. +{{< cosin_i18n "date_month" >}} {{< cosin "date_year" >}} +{{< cosin_i18n "location_name_preposition" >}} [{{< cosin "location_name" >}}]({{< cosin "location_url" >}}) +in {{< cosin_i18n "location_city" >}} statt. ## Wie kann ich mich beteiligen? diff --git a/content/cfp.en.md b/content/cfp.en.md index d32c638..003fbee 100644 --- a/content/cfp.en.md +++ b/content/cfp.en.md @@ -21,10 +21,10 @@ voneinander zu lernen und Spass zu haben — nicht nur am Gerät. ## Wann und wo findet die CoSin statt? Die CoSin findet dieses Jahr vom -{{< cosin "date_day_name_start" >}}, den {{< cosin "date_day_start" >}}. bis -{{< cosin "date_day_name_end" >}}, den {{< cosin "date_day_end" >}} -{{< cosin "date_month" >}} {{< cosin "date_year" >}} -{{< cosin "location_name_preposition" >}} [{{< cosin "location_name" >}}]({{< cosin "location_url" >}}) in {{< cosin "location_city" >}} statt. +{{< cosin_i18n "date_day_name_start" >}}, den {{< cosin "date_day_start" >}}. bis +{{< cosin_i18n "date_day_name_end" >}}, den {{< cosin "date_day_end" >}} +{{< cosin_i18n "date_month" >}} {{< cosin "date_year" >}} +{{< cosin_i18n "location_name_preposition" >}} [{{< cosin "location_name" >}}]({{< cosin "location_url" >}}) in {{< cosin_i18n "location_city" >}} statt. ## Wie kann ich mich beteiligen? diff --git a/content/cfp.fr.md b/content/cfp.fr.md index c8c8b8a..abdbbb2 100644 --- a/content/cfp.fr.md +++ b/content/cfp.fr.md @@ -20,10 +20,10 @@ seulement sur leur machines ! ## Quand et où le CoSin aura lieu ? Cette année le CoSin aura lieu du -{{< cosin "date_day_name_start" >}} {{< cosin "date_day_start" >}} au -{{< cosin "date_day_name_end" >}} {{< cosin "date_day_end" >}} -{{< cosin "date_month" >}} -{{< cosin "location_name_preposition" >}} [{{< cosin "location_name" >}}]({{< cosin "location_url" >}}) à {{< cosin "location_city" >}}. +{{< cosin_i18n "date_day_name_start" >}} {{< cosin "date_day_start" >}} au +{{< cosin_i18n "date_day_name_end" >}} {{< cosin "date_day_end" >}} +{{< cosin_i18n "date_month" >}} +{{< cosin_i18n "location_name_preposition" >}} [{{< cosin "location_name" >}}]({{< cosin "location_url" >}}) à {{< cosin_i18n "location_city" >}}. ## Comment est-ce que je participe ? diff --git a/content/cfp.it.md b/content/cfp.it.md index c89cbdd..36196b1 100644 --- a/content/cfp.it.md +++ b/content/cfp.it.md @@ -20,10 +20,10 @@ solo al computer. ## Quando e dove si svolge la CoSin? Quest'anno la CoSin si svolge da -{{< cosin "date_day_name_start" >}} {{< cosin "date_day_start" >}}. fino a -{{< cosin "date_day_name_end" >}} {{< cosin "date_day_end" >}}. -{{< cosin "date_month" >}} {{< cosin "date_year" >}}, -{{< cosin "location_name_preposition" >}} [{{< cosin "location_name" >}}]({{< cosin "location_url" >}}) a {{< cosin "location_city" >}}. +{{< cosin_i18n "date_day_name_start" >}} {{< cosin "date_day_start" >}}. fino a +{{< cosin_i18n "date_day_name_end" >}} {{< cosin "date_day_end" >}}. +{{< cosin_i18n "date_month" >}} {{< cosin "date_year" >}}, +{{< cosin_i18n "location_name_preposition" >}} [{{< cosin "location_name" >}}]({{< cosin "location_url" >}}) a {{< cosin_i18n "location_city" >}}. ## Come posso contribuire? diff --git a/content/infos.de.md b/content/infos.de.md index 2ff5583..43c657a 100644 --- a/content/infos.de.md +++ b/content/infos.de.md @@ -10,8 +10,8 @@ menu: ## Datum Das CoSin {{< cosin "date_year" >}} findet vom -Freitag, {{< cosin "date_day_start" >}}. {{< cosin "date_month" >}} bis zum -Sonntag, {{< cosin "date_day_end" >}}. {{< cosin "date_month" >}} +Freitag, {{< cosin "date_day_start" >}}. {{< cosin_i18n "date_month" >}} bis zum +Sonntag, {{< cosin "date_day_end" >}}. {{< cosin_i18n "date_month" >}} {{< cosin "date_year" >}} statt. ## Kosten diff --git a/content/infos.en.md b/content/infos.en.md index 0c7d44d..e69539f 100644 --- a/content/infos.en.md +++ b/content/infos.en.md @@ -10,8 +10,8 @@ menu: ## Date CoSin {{< cosin "date_year" >}} takes place from -{{< cosin "date_day_name_start" >}}, {{< cosin "date_month" >}} {{< cosin "date_day_start" >}}th until -{{< cosin "date_day_name_end" >}}, {{< cosin "date_month" >}} {{< cosin "date_day_end" >}}th +{{< cosin_i18n "date_day_name_start" >}}, {{< cosin_i18n "date_month" >}} {{< cosin "date_day_start" >}}th until +{{< cosin_i18n "date_day_name_end" >}}, {{< cosin_i18n "date_month" >}} {{< cosin "date_day_end" >}}th {{< cosin "date_year" >}}. ## Cost diff --git a/content/infos.fr.md b/content/infos.fr.md index 8f9536e..9e2aaa9 100644 --- a/content/infos.fr.md +++ b/content/infos.fr.md @@ -10,8 +10,8 @@ menu: ## Date Le CoSin {{< cosin "date_year" >}} se déroule du -{{< cosin "date_day_name_start" >}} {{< cosin "date_day_start" >}} au -{{< cosin "date_day_name_end" >}} {{< cosin "date_day_end" >}} {{< cosin "date_month" >}} +{{< cosin_i18n "date_day_name_start" >}} {{< cosin "date_day_start" >}} au +{{< cosin_i18n "date_day_name_end" >}} {{< cosin "date_day_end" >}} {{< cosin_i18n "date_month" >}} {{< cosin "date_year" >}}. ## Coûts diff --git a/content/infos.it.md b/content/infos.it.md index 47dd368..8bedf04 100644 --- a/content/infos.it.md +++ b/content/infos.it.md @@ -10,10 +10,10 @@ menu: ## Data Quest'anno la CoSin si svolge da -{{< cosin "date_day_name_start" >}} {{< cosin "date_day_start" >}}. fino a -{{< cosin "date_day_name_end" >}} {{< cosin "date_day_end" >}}. {{< cosin "date_month" >}} +{{< cosin_i18n "date_day_name_start" >}} {{< cosin "date_day_start" >}}. fino a +{{< cosin_i18n "date_day_name_end" >}} {{< cosin "date_day_end" >}}. {{< cosin_i18n "date_month" >}} {{< cosin "date_year" >}}, -{{< cosin "location_name_preposition" >}} [{{< cosin "location_name" >}}]({{< cosin "location_url" >}}) a {{< cosin "location_city" >}}. +{{< cosin_i18n "location_name_preposition" >}} [{{< cosin "location_name" >}}]({{< cosin "location_url" >}}) a {{< cosin_i18n "location_city" >}}. ## Costi diff --git a/content/ort.de.md b/content/ort.de.md index abc0bc0..e1274ff 100644 --- a/content/ort.de.md +++ b/content/ort.de.md @@ -9,7 +9,7 @@ menu: ## Ort -Das CoSin findet {{< cosin "location_name_preposition" >}} [{{< cosin "location_name" >}}][1] in {{< cosin "location_city" >}} statt. +Das CoSin findet {{< cosin_i18n "location_name_preposition" >}} [{{< cosin "location_name" >}}][1] in {{< cosin_i18n "location_city" >}} statt. ## Photos diff --git a/content/ort.en.md b/content/ort.en.md index e1766e6..b8de2d7 100644 --- a/content/ort.en.md +++ b/content/ort.en.md @@ -9,7 +9,7 @@ menu: ## Location -This year's CoSin takes place {{< cosin "location_name_preposition" >}} [{{< cosin "location_name" >}}][1] in {{< cosin "location_city" >}}. +This year's CoSin takes place {{< cosin_i18n "location_name_preposition" >}} [{{< cosin "location_name" >}}][1] in {{< cosin_i18n "location_city" >}}. ## Photos diff --git a/content/ort.fr.md b/content/ort.fr.md index 52d1e00..98c85db 100644 --- a/content/ort.fr.md +++ b/content/ort.fr.md @@ -9,7 +9,7 @@ menu: ## Lieu -Le CoSin se déroule {{< cosin "location_name_preposition" >}} [{{< cosin "location_name" >}}][1] à {{< cosin "location_city" >}}. +Le CoSin se déroule {{< cosin_i18n "location_name_preposition" >}} [{{< cosin "location_name" >}}][1] à {{< cosin_i18n "location_city" >}}. ## Photos diff --git a/content/ort.it.md b/content/ort.it.md index 76a5992..b4233e2 100644 --- a/content/ort.it.md +++ b/content/ort.it.md @@ -9,7 +9,7 @@ menu: ## Luogo -La CoSin si svolge {{< cosin "location_name_preposition" >}} [{{< cosin "location_name" >}}][1] a {{< cosin "location_city" >}}. +La CoSin si svolge {{< cosin_i18n "location_name_preposition" >}} [{{< cosin "location_name" >}}][1] a {{< cosin_i18n "location_city" >}}. ## Foto diff --git a/layouts/shortcodes/cosin.html b/layouts/shortcodes/cosin.html index 89b5ad1..f95f2b9 100644 --- a/layouts/shortcodes/cosin.html +++ b/layouts/shortcodes/cosin.html @@ -1,2 +1,2 @@ {{ $value := index .Site.Data.cosin (.Get 0) }} -{{- i18n $value | default $value -}} +{{- $value -}} diff --git a/layouts/shortcodes/cosin_i18n.html b/layouts/shortcodes/cosin_i18n.html new file mode 100644 index 0000000..da12670 --- /dev/null +++ b/layouts/shortcodes/cosin_i18n.html @@ -0,0 +1,2 @@ +{{ $value := index .Site.Data.cosin (.Get 0) }} +{{- i18n $value -}}