From ec919bac1d53d0159ec62cc17c2ff5fac99f0d0a Mon Sep 17 00:00:00 2001 From: katesalazar Date: Sat, 8 Jan 2022 21:46:19 +0000 Subject: [PATCH 1/4] Translate 'Published on' label Translate the 'Published on' label installed by rev 6921359eec of Oct 5 2021. --- _data/home.yml | 10 ++++++++++ _layouts/home.html | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 _data/home.yml diff --git a/_data/home.yml b/_data/home.yml new file mode 100644 index 000000000..bd976864a --- /dev/null +++ b/_data/home.yml @@ -0,0 +1,10 @@ +en: + published_on: 'Published on' +zh_CN: + published_on: 'Published on' +zh_TW: + published_on: 'Published on' +ja: + published_on: 'Published on' +es: + published_on: 'Publicado el' diff --git a/_layouts/home.html b/_layouts/home.html index 9cf9a3be6..83188f8a2 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -50,7 +50,7 @@

{{ post.

{{ post.title }}

{{ post.excerpt | markdownify | strip_html | truncate: 160 }}

- Published on {{ post.date | date: "%B %d, %Y" }} + {{ site.data.home[page.lang]['published_on'] }} {{ post.date | date: "%B %d, %Y" }}

{% endif %} From 4eedf35faf5708d2e0ba451a0f6f0fb4b764c6f1 Mon Sep 17 00:00:00 2001 From: katesalazar Date: Sat, 8 Jan 2022 22:15:39 +0000 Subject: [PATCH 2/4] Oncleben31 date translating code and data (1/2) Add oncleben31/jekyll-date-basic-i18n as is at its rev b538b347. This is the literal code and data, pending license notices. See also: http://jch.penibelst.de. --- _data/locales/ar.yml | 44 ++++++++++++++++++++++++++ _data/locales/cz.yml | 44 ++++++++++++++++++++++++++ _data/locales/da.yml | 44 ++++++++++++++++++++++++++ _data/locales/de.yml | 44 ++++++++++++++++++++++++++ _data/locales/en.yml | 44 ++++++++++++++++++++++++++ _data/locales/es.yml | 44 ++++++++++++++++++++++++++ _data/locales/fi.yml | 44 ++++++++++++++++++++++++++ _data/locales/fr.yml | 44 ++++++++++++++++++++++++++ _data/locales/pl.yml | 44 ++++++++++++++++++++++++++ _includes/translated_date.html | 57 ++++++++++++++++++++++++++++++++++ 10 files changed, 453 insertions(+) create mode 100644 _data/locales/ar.yml create mode 100644 _data/locales/cz.yml create mode 100644 _data/locales/da.yml create mode 100644 _data/locales/de.yml create mode 100644 _data/locales/en.yml create mode 100644 _data/locales/es.yml create mode 100644 _data/locales/fi.yml create mode 100644 _data/locales/fr.yml create mode 100644 _data/locales/pl.yml create mode 100644 _includes/translated_date.html diff --git a/_data/locales/ar.yml b/_data/locales/ar.yml new file mode 100644 index 000000000..44c42a48f --- /dev/null +++ b/_data/locales/ar.yml @@ -0,0 +1,44 @@ +# Strings for dates +# language Arabic +abbreviated_weekday: + - ح + - ن + - ث + - ر + - خ + - ج + - س +full_weekday: + - الأحد + - الاثنين + - الثلاثاء + - الأربعاء + - الخميس + - الجمعة + - السبت +abbreviated_month: + - ي + - ف + - م + - أ + - و + - ن + - ل + - غ + - س + - ك + - ب + - د +full_month: + - يناير + - فبراير + - مارس + - أبريل + - مايو + - يونيو + - يوليو + - أغسطس + - سبتمبر + - أكتوبر + - نوفمبر + - ديسمبر diff --git a/_data/locales/cz.yml b/_data/locales/cz.yml new file mode 100644 index 000000000..be6ccfe8a --- /dev/null +++ b/_data/locales/cz.yml @@ -0,0 +1,44 @@ +# Strings for dates +# language Czech +abbreviated_weekday: + - ne + - po + - út + - st + - čt + - pá + - so +full_weekday: + - neděle + - pondělí + - úterý + - středa + - čtvrtek + - pátek + - sobota +abbreviated_month: + - led + - úno + - bře + - dub + - kvě + - čvn + - čvc + - srp + - zář + - říj + - lis + - pro +full_month: + - ledna + - února + - března + - dubna + - května + - června + - července + - srpna + - září + - října + - listopadu + - prosince diff --git a/_data/locales/da.yml b/_data/locales/da.yml new file mode 100644 index 000000000..241e88c2e --- /dev/null +++ b/_data/locales/da.yml @@ -0,0 +1,44 @@ +# Strings for dates +# language Danish +abbreviated_weekday: + - Søn + - Man + - Tir + - Ons + - Tor + - Fre + - Lør +full_weekday: + - Søndag + - Mandag + - Tirsdag + - Onsdag + - Torsdag + - Fredag + - Lørdag +abbreviated_month: + - Jan + - Feb + - Mar + - Apr + - Maj + - Jun + - Jul + - Aug + - Sep + - Okt + - Nov + - Dec +full_month: + - Januar + - Februar + - Marts + - April + - Maj + - Juni + - Juli + - August + - September + - Oktober + - November + - December diff --git a/_data/locales/de.yml b/_data/locales/de.yml new file mode 100644 index 000000000..291b639c3 --- /dev/null +++ b/_data/locales/de.yml @@ -0,0 +1,44 @@ +# Strings for dates +# language German +abbreviated_weekday: + - So + - Mo + - Di + - Mi + - Do + - Fr + - Sa +full_weekday: + - Sonntag + - Montag + - Dienstag + - Mittwoch + - Donnerstag + - Freitag + - Samstag +abbreviated_month: + - Jan + - Feb + - Mär + - Apr + - Mai + - Jun + - Jul + - Aug + - Sep + - Okt + - Nov + - Dez +full_month: + - Januar + - Februar + - März + - April + - Mai + - Juni + - Juli + - August + - September + - Oktober + - November + - Dezember diff --git a/_data/locales/en.yml b/_data/locales/en.yml new file mode 100644 index 000000000..79b467c56 --- /dev/null +++ b/_data/locales/en.yml @@ -0,0 +1,44 @@ +# Strings for dates +# language English +abbreviated_weekday: + - Sun + - Mon + - Tue + - Wed + - Thu + - Fri + - Sat +full_weekday: + - Sunday + - Monday + - Tuesday + - Wednesday + - Thursday + - Friday + - Saturday +abbreviated_month: + - Jan + - Feb + - Mar + - Apr + - May + - Jun + - Jul + - Aug + - Sep + - Oct + - Nov + - Dec +full_month: + - January + - February + - March + - April + - May + - June + - July + - August + - September + - October + - November + - December diff --git a/_data/locales/es.yml b/_data/locales/es.yml new file mode 100644 index 000000000..6efd986b7 --- /dev/null +++ b/_data/locales/es.yml @@ -0,0 +1,44 @@ +# Strings for dates +# language Spanish +abbreviated_weekday: + - Dom + - Lun + - Mar + - Mie + - Jue + - Vie + - Sab +full_weekday: + - Domingo + - Lunes + - Martes + - Miércoles + - Jueves + - Viernes + - Sábado +abbreviated_month: + - Ene + - Feb + - Mar + - Abr + - May + - Jun + - Jul + - Ago + - Sep + - Oct + - Nov + - Dic +full_month: + - Enero + - Febrero + - Marzo + - Abril + - Mayo + - Junio + - Julio + - Agosto + - Septiembre + - Octubre + - Noviembre + - Diciembre diff --git a/_data/locales/fi.yml b/_data/locales/fi.yml new file mode 100644 index 000000000..bb1a6bd06 --- /dev/null +++ b/_data/locales/fi.yml @@ -0,0 +1,44 @@ +# Strings for dates +# language Finnish +abbreviated_weekday: + - Su + - Ma + - Ti + - Ke + - To + - Pe + - La +full_weekday: + - Sunnuntai + - Maanantai + - Tiistai + - Keskiviikko + - Torstai + - Perjantai + - Lauantai +abbreviated_month: + - Tammi + - Helmi + - Maalis + - Huhti + - Touko + - Kesä + - Heinä + - Elo + - Syys + - Loka + - Marras + - Joulu +full_month: + - Tammikuu + - Helmikuu + - Maaliskuu + - Huhtikuu + - Toukokuu + - Kesäkuu + - Heinäkuu + - Elokuu + - Syyskuu + - Lokakuu + - Marraskuu + - Joulukuu diff --git a/_data/locales/fr.yml b/_data/locales/fr.yml new file mode 100644 index 000000000..7ec59e5b8 --- /dev/null +++ b/_data/locales/fr.yml @@ -0,0 +1,44 @@ +# Strings for dates +# language French +abbreviated_weekday: + - Dim + - Lun + - Mar + - Mer + - Jeu + - Ven + - Sam +full_weekday: + - Dimanche + - Lundi + - Mardi + - Mercredi + - Jeudi + - Vendredi + - Samedi +abbreviated_month: + - jan. + - fév. + - mar. + - avr. + - mai + - juin + - juil. + - août + - sept. + - oct. + - nov. + - déc. +full_month: + - janvier + - février + - mars + - avril + - mai + - juin + - juillet + - août + - septembre + - octobre + - novembre + - décembre diff --git a/_data/locales/pl.yml b/_data/locales/pl.yml new file mode 100644 index 000000000..a041e797e --- /dev/null +++ b/_data/locales/pl.yml @@ -0,0 +1,44 @@ +# Strings for dates +# language Polish +abbreviated_weekday: + - Nie + - Pon + - Wto + - Śro + - Czw + - Pią + - Sob +full_weekday: + - Niedziela + - Poniedziałek + - Wtorek + - Środa + - Czwartek + - Piątek + - Sobota +abbreviated_month: + - Sty + - Lut + - Mar + - Kwi + - Maj + - Cze + - Lip + - Sie + - Wrz + - Paź + - Lis + - Gru +full_month: + - Styczeń + - Luty + - Marzec + - Kwiecień + - Maj + - Czerwiec + - Lipiec + - Sierpień + - Wrzesień + - Październik + - Listopad + - Grudzień diff --git a/_includes/translated_date.html b/_includes/translated_date.html new file mode 100644 index 000000000..c63d3399b --- /dev/null +++ b/_includes/translated_date.html @@ -0,0 +1,57 @@ +{% comment %} +This include allows to translate the days and months in the date by using strings in _data/locales/[lang].yml +This include can be called with three parameters: + - include.date: the date to be processed + - include.format: the date format. (If empty a default format will be used) + - include.lang: lang to use for translation. +{% endcomment %} + +{% comment %} +If the parameter date format is empty the default format set in _config.yml is used. +If there is no default in _config, "%b %-d, %Y" is used. +{% endcomment %} + +{% assign date_format_to_be_translated = include.format | default: site.date_format | default: "%b %-d, %Y" %} + +{% comment %} +Init to have the indice of the day in the week (num_day) and the indice of the month in the year (num_mont) +Init the lang parameter depending if it's set in the include call, in the page or in the site settings +{% endcomment %} + +{% assign num_day = include.date | date: "%w" | plus: 0 %} +{% assign num_month = include.date | date: "%-m" | plus: -1 %} +{% assign lang = include.lang | default: page.lang | default: site.lang %} + +{% comment %} +Use translated abbreviated weekday if "%a" is used in the format and the translation is available in _data/locales/[lang].yml +{% endcomment %} + +{% if site.data.locales[lang].abbreviated_weekday[num_day] %} + {% assign date_format_to_be_translated = date_format_to_be_translated | replace: "%a", site.data.locales[lang].abbreviated_weekday[num_day] %} +{% endif %} + +{% comment %} +Use translated full weekday if "%A" is used in the format and the translation is available in _data/locales/[lang].yml +{% endcomment %} + +{% if site.data.locales[lang].full_weekday[num_day] %} + {% assign date_format_to_be_translated = date_format_to_be_translated | replace: "%A", site.data.locales[lang].full_weekday[num_day] %} +{% endif %} + +{% comment %} +Use translated abbreviated month if "%b" is used in the format and the translation is available in _data/locales/[lang].yml +{% endcomment %} + +{% if site.data.locales[lang].abbreviated_month[num_month] %} + {% assign date_format_to_be_translated = date_format_to_be_translated | replace: "%b", site.data.locales[lang].abbreviated_month[num_month] %} +{% endif %} + +{% comment %} +Use translated abbreviated weekday if "%B" is used in the format and the translation is available in _data/locales/[lang].yml +{% endcomment %} + +{% if site.data.locales[lang].full_month[num_month] %} + {% assign date_format_to_be_translated = date_format_to_be_translated | replace: "%B", site.data.locales[lang].full_month[num_month] %} +{% endif %} + +{{ include.date | date: date_format_to_be_translated }} From 67ce4fcc522bff7289be09d1bc57fc232032e9bd Mon Sep 17 00:00:00 2001 From: katesalazar Date: Sat, 8 Jan 2022 23:21:24 +0000 Subject: [PATCH 3/4] Oncleben31 date translating code and data (2/2) Add oncleben31/jekyll-date-basic-i18n as is at its rev b538b347. Completes the previous rev with the license notices. See also: http://jch.penibelst.de. --- _data/locales/ar.yml | 22 ++++++++++++++++++++++ _data/locales/cz.yml | 22 ++++++++++++++++++++++ _data/locales/da.yml | 22 ++++++++++++++++++++++ _data/locales/de.yml | 22 ++++++++++++++++++++++ _data/locales/en.yml | 22 ++++++++++++++++++++++ _data/locales/es.yml | 22 ++++++++++++++++++++++ _data/locales/fi.yml | 22 ++++++++++++++++++++++ _data/locales/fr.yml | 22 ++++++++++++++++++++++ _data/locales/pl.yml | 22 ++++++++++++++++++++++ _includes/translated_date.html | 26 ++++++++++++++++++++++++++ 10 files changed, 224 insertions(+) diff --git a/_data/locales/ar.yml b/_data/locales/ar.yml index 44c42a48f..98cdbdce8 100644 --- a/_data/locales/ar.yml +++ b/_data/locales/ar.yml @@ -1,3 +1,25 @@ +# MIT License +# +# Copyright (c) 2016 Oncleben31 +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # Strings for dates # language Arabic abbreviated_weekday: diff --git a/_data/locales/cz.yml b/_data/locales/cz.yml index be6ccfe8a..7ccf0891f 100644 --- a/_data/locales/cz.yml +++ b/_data/locales/cz.yml @@ -1,3 +1,25 @@ +# MIT License +# +# Copyright (c) 2016 Oncleben31 +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # Strings for dates # language Czech abbreviated_weekday: diff --git a/_data/locales/da.yml b/_data/locales/da.yml index 241e88c2e..b2f32e133 100644 --- a/_data/locales/da.yml +++ b/_data/locales/da.yml @@ -1,3 +1,25 @@ +# MIT License +# +# Copyright (c) 2016 Oncleben31 +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # Strings for dates # language Danish abbreviated_weekday: diff --git a/_data/locales/de.yml b/_data/locales/de.yml index 291b639c3..5dc98e4cf 100644 --- a/_data/locales/de.yml +++ b/_data/locales/de.yml @@ -1,3 +1,25 @@ +# MIT License +# +# Copyright (c) 2016 Oncleben31 +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # Strings for dates # language German abbreviated_weekday: diff --git a/_data/locales/en.yml b/_data/locales/en.yml index 79b467c56..f8a1440dc 100644 --- a/_data/locales/en.yml +++ b/_data/locales/en.yml @@ -1,3 +1,25 @@ +# MIT License +# +# Copyright (c) 2016 Oncleben31 +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # Strings for dates # language English abbreviated_weekday: diff --git a/_data/locales/es.yml b/_data/locales/es.yml index 6efd986b7..be76795a2 100644 --- a/_data/locales/es.yml +++ b/_data/locales/es.yml @@ -1,3 +1,25 @@ +# MIT License +# +# Copyright (c) 2016 Oncleben31 +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # Strings for dates # language Spanish abbreviated_weekday: diff --git a/_data/locales/fi.yml b/_data/locales/fi.yml index bb1a6bd06..4fae8780a 100644 --- a/_data/locales/fi.yml +++ b/_data/locales/fi.yml @@ -1,3 +1,25 @@ +# MIT License +# +# Copyright (c) 2016 Oncleben31 +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # Strings for dates # language Finnish abbreviated_weekday: diff --git a/_data/locales/fr.yml b/_data/locales/fr.yml index 7ec59e5b8..fdf715aa9 100644 --- a/_data/locales/fr.yml +++ b/_data/locales/fr.yml @@ -1,3 +1,25 @@ +# MIT License +# +# Copyright (c) 2016 Oncleben31 +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # Strings for dates # language French abbreviated_weekday: diff --git a/_data/locales/pl.yml b/_data/locales/pl.yml index a041e797e..fe6486341 100644 --- a/_data/locales/pl.yml +++ b/_data/locales/pl.yml @@ -1,3 +1,25 @@ +# MIT License +# +# Copyright (c) 2016 Oncleben31 +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + # Strings for dates # language Polish abbreviated_weekday: diff --git a/_includes/translated_date.html b/_includes/translated_date.html index c63d3399b..2b3e03942 100644 --- a/_includes/translated_date.html +++ b/_includes/translated_date.html @@ -1,3 +1,29 @@ +{% comment %} + +MIT License + +Copyright (c) 2016 Oncleben31 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +{% endcomment %} + {% comment %} This include allows to translate the days and months in the date by using strings in _data/locales/[lang].yml This include can be called with three parameters: From 1638fba1585ba959ee561cf9ec5e667f0bd43be4 Mon Sep 17 00:00:00 2001 From: katesalazar Date: Sat, 8 Jan 2022 22:33:03 +0000 Subject: [PATCH 4/4] Localize dates using Oncleben31 code --- _data/translations.yml | 5 +++++ _layouts/home.html | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/_data/translations.yml b/_data/translations.yml index 1d2ed1937..3e213b56c 100644 --- a/_data/translations.yml +++ b/_data/translations.yml @@ -11,6 +11,7 @@ en: rss_feed: "Bitcoin Core Blog RSS Feed" rss_meetings_feed: "Meetings feed" rss_blog_feed: "Blog posts feed" + date_format: "%B %d, %Y" zh_CN: created: "发布在" @@ -25,6 +26,7 @@ zh_CN: rss_feed: "Bitcoin Core Blog RSS Feed" rss_meetings_feed: "Meetings feed" rss_blog_feed: "Blog posts feed" + date_format: "%B %d, %Y" zh_TW: created: "發表於" @@ -39,6 +41,7 @@ zh_TW: rss_feed: "Bitcoin Core Blog RSS Feed" rss_meetings_feed: "Meetings feed" rss_blog_feed: "Blog posts feed" + date_format: "%B %d, %Y" ja: created: "Published on the" @@ -53,6 +56,7 @@ ja: rss_feed: "Bitcoin Core Blog RSS Feed" rss_meetings_feed: "Meetings feed" rss_blog_feed: "Blog posts feed" + date_format: "%B %d, %Y" es: created: "Publicado el" @@ -67,3 +71,4 @@ es: rss_feed: "Fuente RSS del Blog de Bitcoin Core" rss_meetings_feed: "Feed de reuniones" rss_blog_feed: "Feed de entradas del blog" + date_format: "%d de %B de %Y" diff --git a/_layouts/home.html b/_layouts/home.html index 83188f8a2..7953b8dbe 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -50,7 +50,9 @@

{{ post.

{{ post.title }}

{{ post.excerpt | markdownify | strip_html | truncate: 160 }}

- {{ site.data.home[page.lang]['published_on'] }} {{ post.date | date: "%B %d, %Y" }} + {% assign dateformat=site.data.translations[page.lang].date_format %} + {{ site.data.home[page.lang]['published_on'] }} + {% include translated_date.html date=post.date format=dateformat lang=page.lang %}

{% endif %}