From 3720c8b0146c10a63dc1d9eba0556e0a67adfd1d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 12 Aug 2020 12:06:07 -0300 Subject: Use _includes/i18n-date.html for dates --- _config.yml | 30 +++++++++++++++++++++++++++--- _includes/i18n-date.html | 11 +++++++++++ _layouts/index.html | 2 +- _layouts/pastebin.html | 2 +- _layouts/pastebins-listing.html | 2 +- _layouts/post.html | 6 +++--- _layouts/tils-listing.html | 2 +- 7 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 _includes/i18n-date.html diff --git a/_config.yml b/_config.yml index 2fdccd6..18677c9 100644 --- a/_config.yml +++ b/_config.yml @@ -76,9 +76,6 @@ t: til: en: "/feed.til.en.atom" pt: "/feed.til.pt.atom" - date_format: - en: "%B %-d, %Y" - pt: "%-d de %B de %Y" posted_on: en: "Posted on" pt: "Postado em" @@ -100,3 +97,30 @@ t: The content for this site is licensed under CC-BY-SA. The code is GPLv3 or later. pt: >- O conteúdo desse site é licensiado sob a licença CC-BY-SA. O código é GPLv3 ou versões maiores. + months: + en: + - January + - February + - March + - April + - May + - June + - July + - August + - September + - October + - November + - December + pt: + - Janeiro + - Fevereiro + - Março + - Abril + - Mail + - Junho + - Julho + - Agosto + - Setembro + - Outubro + - Novembro + - Dezembro diff --git a/_includes/i18n-date.html b/_includes/i18n-date.html new file mode 100644 index 0000000..9b73600 --- /dev/null +++ b/_includes/i18n-date.html @@ -0,0 +1,11 @@ +{% capture i18n_month %} +{% assign m = include.date | date: "%-m" | minus: 1 %} +{{ site.t.months[page.lang][m] }} +{% endcapture %} +{% if page.lang == "en" %} + + {{ i18n_month }}{{ include.date | date: "%-d, %Y" }} +{% elsif page.lang == "pt" %} + + {{ include.date | date: "%-d de " }}{{ i18n_month }}{{ include.date | date: " de %Y" }} +{% endif %} diff --git a/_layouts/index.html b/_layouts/index.html index 1ce99ca..2e39734 100644 --- a/_layouts/index.html +++ b/_layouts/index.html @@ -12,7 +12,7 @@ layout: default diff --git a/_layouts/pastebin.html b/_layouts/pastebin.html index 21e4f65..4314ca2 100644 --- a/_layouts/pastebin.html +++ b/_layouts/pastebin.html @@ -3,7 +3,7 @@ layout: default ---
- Posted on {{ page.date | date: site.t.date_format[page.lang] }} + Posted on {% include i18n-date.html date=page.date %}
{{ content }} diff --git a/_layouts/pastebins-listing.html b/_layouts/pastebins-listing.html index 4c37c93..58837e1 100644 --- a/_layouts/pastebins-listing.html +++ b/_layouts/pastebins-listing.html @@ -6,7 +6,7 @@ layout: default {% assign pastebins = site.pastebins | sort: "date" | reverse %} {%- for pastebin in pastebins -%}
  • - {{ pastebin.title | escape }} - {{ pastebin.date | date: site.t.date_format[page.lang] }} + {{ pastebin.title | escape }} - {% include i18n-date.html date=pastebin.date %}
  • {%- endfor -%} diff --git a/_layouts/post.html b/_layouts/post.html index 18debe5..0bb165f 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -3,11 +3,11 @@ layout: default ---
    - {{ site.t.posted_on[page.lang] }} {{ page.date | date: site.t.date_format[page.lang] }} + {{ site.t.posted_on[page.lang] }} {% include i18n-date.html date=page.date %}
    {% if page.updated_at %} -
    - {{ site.t.updated_at[page.lang] }} {{ page.updated_at | date: site.t.date_format[page.lang] }} +
    + {{ site.t.updated_at[page.lang] }}
    {% endif %}
    diff --git a/_layouts/tils-listing.html b/_layouts/tils-listing.html index e254125..38cec2b 100644 --- a/_layouts/tils-listing.html +++ b/_layouts/tils-listing.html @@ -12,7 +12,7 @@ layout: default {% assign tils = site.tils | where:"lang", page.lang | sort: "date" | reverse %} {%- for til in tils -%}
  • - {{ til.title | escape }} - {{ til.date | date: site.t.date_format[page.lang] }} + {{ til.title | escape }} - {% include i18n-date.html date=til.date %}
  • {%- endfor -%} -- cgit v1.2.3