From 2d0788c3981328f1fbd9de4274d2925bf9586e03 Mon Sep 17 00:00:00 2001
From: Jieiku
Date: Mon, 22 May 2023 22:39:16 -0700
Subject: Add multi-lingual Support
---
templates/macros/macros.html | 30 +++++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)
(limited to 'templates/macros/macros.html')
diff --git a/templates/macros/macros.html b/templates/macros/macros.html
index 95c922c..e909b06 100644
--- a/templates/macros/macros.html
+++ b/templates/macros/macros.html
@@ -36,16 +36,24 @@
{%- if config.extra.meta_post.divider %}{{ config.extra.meta_post.divider | safe }}{%- else %} {%- endif %}{%- endif %}{%- endif %}
{#- Date #}
- {%- if config.extra.meta_post.date %} {%- if config.extra.icon_date %} {% endif %} {{ page.date | date(format="%B %d, %Y") }}
+ {%- if config.extra.meta_post.date %} {%- if config.extra.icon_date %} {% endif %}
+ {%- if config.extra.date_locale %}
+ {%- if lang != config.default_language -%}
+ {%- set lang_locale = trans(key="date_locale" | safe, lang=lang) -%}
+ {%- 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 %}
{#- divider #}
{%- if config.extra.meta_post.categories_tags %}
{%- if config.extra.meta_post.divider %}{{ config.extra.meta_post.divider | safe }}{%- else %} {%- endif %}{%- endif %}{% endif %}
{#- Categories #}
- {%- if page.taxonomies.categories %} {%- if config.extra.icon_info %} {% endif %} [{% for cat in page.taxonomies.categories %}{{ cat }}{% endfor %}]{% endif %}
+ {%- if page.taxonomies.categories %} {%- if config.extra.icon_info %} {% endif %} [{% for cat in page.taxonomies.categories %}{{ cat }}{% endfor %}]{% endif %}
{#- Tags #}
- {%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #{{ tag }} {% endfor -%}{%- endif %}
+ {%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #{{ tag }} {% endfor -%}{%- endif %}
{%- endmacro meta_post %}
{%- macro title_index(page, config) %}
@@ -60,7 +68,7 @@
{%- if page.taxonomies.authors and config.taxonomies %}
{%- for author in page.taxonomies.authors %}
{%- if author_flag %}, {% endif %}
- {{ author }}
+ {{ author }}
{%- set_global author_flag = true %}
{%- endfor %}
{%- elif page.extra.authors and config.extra.meta_index.author %}
@@ -87,16 +95,24 @@
{%- if config.extra.meta_index.divider %}{{ config.extra.meta_index.divider | safe }}{%- else %} {%- endif %}{%- endif %}{%- endif %}
{#- Date #}
- {%- if config.extra.meta_index.date %} {%- if config.extra.icon_date %} {% endif %} {{ page.date | date(format="%B %d, %Y") }}
+ {%- if config.extra.meta_index.date %} {%- if config.extra.icon_date %} {% endif %}
+ {%- if config.extra.date_locale %}
+ {%- if lang != config.default_language -%}
+ {%- set lang_locale = trans(key="date_locale" | safe, lang=lang) -%}
+ {%- 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 %}
{#- divider #}
{%- if config.extra.meta_index.categories_tags %}
{%- if config.extra.meta_index.divider %}{{ config.extra.meta_index.divider | safe }}{%- else %} {%- endif %}{%- endif %}{% endif %}
{#- Categories #}
- {%- if page.taxonomies.categories %} {%- if config.extra.icon_info %} {% endif %} [{% for cat in page.taxonomies.categories %}{{ cat }}{% endfor %}]{% endif %}
+ {%- if page.taxonomies.categories %} {%- if config.extra.icon_info %} {% endif %} [{% for cat in page.taxonomies.categories %}{{ cat }}{% endfor %}]{% endif %}
{#- Tags #}
- {%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #{{ tag }} {% endfor -%}{%- endif %}
+ {%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #{{ tag }} {% endfor -%}{%- endif %}
{%- endmacro meta_index %}
--
cgit v1.3.1