Skip to content

Commit

Permalink
Multilingual Fix Date
Browse files Browse the repository at this point in the history
  • Loading branch information
Jieiku committed Nov 3, 2023
1 parent 6a5d3bd commit 87b7616
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 31 deletions.
2 changes: 2 additions & 0 deletions content/overview-abridge/index.fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ js_copycode = false
js_email_encode = false
js_prestyle = false
js_switcher = false

pwa = false
```

Voici les fichiers javascript utilisés par Abridge :
Expand Down
2 changes: 2 additions & 0 deletions content/overview-abridge/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ js_copycode = false
js_email_encode = false
js_prestyle = false
js_switcher = false

pwa = false
```

These are the javascript files used by Abridge:
Expand Down
43 changes: 12 additions & 31 deletions templates/macros/macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,28 +71,19 @@ <h1><a href="{{ page.permalink | safe }}{%- if uglyurls %}index.html{%- endif %}

{#- Date #}
{%- if config.extra.meta_post.date %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif %}
{%- if config.extra.date_locale %}
{%- if lang != config.default_language -%}
{%- set lang_locale = macros::translate(key='date_locale', default='en_US', i18n=i18n) -%}
{%- else -%}
{%- set lang_locale = config.extra.date_locale -%}
{%- endif -%}
{{ page.date | date(format="%B %d, %Y", locale=lang_locale) }}
{%- else %} {{ page.date | date(format="%B %d, %Y") }} {%- endif %}
{%- set lang_locale = macros::translate(key='date_locale', default='en_US', i18n=i18n) -%}
{%- set page_date = page.date | date(format="%B %d, %Y", locale=lang_locale) -%}
{%- if page_date %} {{ page_date }} {%- else %} {{ page.date | date(format="%B %d, %Y") }} {%- endif %}
{#- divider #}
{%- if config.extra.meta_post.updated or config.extra.meta_post.categories_tags %}
{%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{% endif %}

{#- Updated #}
{%- if config.extra.meta_post.updated and page.updated %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif -%}
{{ macros::translate(key="Updated", default="Updated", i18n=i18n) }}:
{%- if config.extra.date_locale %}
{%- if lang != config.default_language -%}
{%- set lang_locale = macros::translate(key='date_locale', default='en_US', i18n=i18n) -%}
{%- else -%}
{%- set lang_locale = config.extra.date_locale -%}
{%- endif %} {{ page.updated | date(format="%B %d, %Y", locale=lang_locale) }}
{%- else %} {{ page.updated | date(format="%B %d, %Y") }} {%- endif %}
{%- set lang_locale = macros::translate(key='date_locale', default='en_US', i18n=i18n) -%}
{%- set page_updated = page.updated | date(format="%B %d, %Y", locale=lang_locale) -%}
{%- if page_updated %} {{ page_updated }} {%- else %} {{ page.updated | date(format="%B %d, %Y") }} {%- endif %}
{#- divider #}
{%- if config.extra.meta_post.categories_tags %}
{%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{% endif %}
Expand Down Expand Up @@ -154,29 +145,19 @@ <h1>{% if config.extra.title_size_index %}<span class="{{ config.extra.title_siz

{#- Date #}
{%- if config.extra.meta_index.date %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif %}
{%- if config.extra.date_locale %}
{%- if lang != config.default_language -%}
{%- set lang_locale = macros::translate(key='date_locale', default='en_US', i18n=i18n) -%}
{%- else -%}
{%- set lang_locale = config.extra.date_locale -%}
{%- endif -%}
{{ page.date | date(format="%B %d, %Y", locale=lang_locale) }}
{%- else %} {{ page.date | date(format="%B %d, %Y") }} {%- endif %}
{%- set lang_locale = macros::translate(key='date_locale', default='en_US', i18n=i18n) -%}
{%- set page_date = page.date | date(format="%B %d, %Y", locale=lang_locale) -%}
{%- if page_date %} {{ page_date }} {%- else %} {{ page.date | date(format="%B %d, %Y") }} {%- endif %}
{#- divider #}
{%- if config.extra.meta_index.updated or config.extra.meta_index.categories_tags %}
{%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{% endif %}

{#- Updated #}
{%- if config.extra.meta_index.updated and page.updated %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif -%}
{{ macros::translate(key="Updated", default="Updated", i18n=i18n) }}:
{%- if config.extra.date_locale %}
{%- if lang != config.default_language -%}
{%- set lang_locale = macros::translate(key='date_locale', default='en_US', i18n=i18n) -%}
{%- else -%}
{%- set lang_locale = config.extra.date_locale -%}
{%- endif %} {{ page.updated | date(format="%B %d, %Y", locale=lang_locale) }}
{%- else %} {{ page.updated | date(format="%B %d, %Y") }} {%- endif %}

{%- set lang_locale = macros::translate(key='date_locale', default='en_US', i18n=i18n) -%}
{%- set page_updated = page.updated | date(format="%B %d, %Y", locale=lang_locale) -%}
{%- if page_updated %} {{ page_updated }} {%- else %} {{ page.updated | date(format="%B %d, %Y") }} {%- endif %}
{#- divider #}
{%- if config.extra.meta_index.categories_tags %}
{%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} <span class="rpad"></span> {%- endif %}{%- endif %}{% endif %}
Expand Down

0 comments on commit 87b7616

Please sign in to comment.