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/head.html | 17 ++++----
templates/macros/macros.html | 30 ++++++++++----
templates/macros/social.html | 97 ++++++++++++++++++++++----------------------
3 files changed, 81 insertions(+), 63 deletions(-)
(limited to 'templates/macros')
diff --git a/templates/macros/head.html b/templates/macros/head.html
index 8da09cb..0690bc1 100644
--- a/templates/macros/head.html
+++ b/templates/macros/head.html
@@ -103,7 +103,7 @@
{%- set js_email=config.extra.js_email | default(value="email.js") -%}
{%- if js_email %}
- {%- if config.extra.social.mail_encode | default(value=true) %}
+ {%- if config.extra.mail_encode | default(value=true) %}
{%- endif %}
{%- endif %}
@@ -120,12 +120,15 @@
{%- else %}
- {%- endif %}
-
-{%- endif %}
+ {%- if lang != "en" %}
+
+
+ {%- endif %}
+ {%- endif %}
+{%- endif %}
{#- https://katex.org/docs/autorender.html #}
@@ -344,9 +347,9 @@
{%- endif %}
-{%- if config.extra.social.twitter %}
-
-
+{%- if config.extra.twitter_meta %}
+
+
{%- endif %}
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 %}
diff --git a/templates/macros/social.html b/templates/macros/social.html
index 67e05a3..1c4b3fd 100644
--- a/templates/macros/social.html
+++ b/templates/macros/social.html
@@ -1,59 +1,58 @@
-{%- macro social_links(social_config, config) %}
+{%- macro social_links(config) %}
{%- endmacro %}
--
cgit v1.3.1