diff options
| author | Jieiku | 2023-05-22 22:39:16 -0700 |
|---|---|---|
| committer | Jieiku | 2023-05-22 22:39:16 -0700 |
| commit | 2d0788c3981328f1fbd9de4274d2925bf9586e03 (patch) | |
| tree | cee4b3c0a624ce79fcc14b2c57789a95578e4ea5 /templates/macros/macros.html | |
| parent | 6dcec618d0ff0a2270f787f62267a0622275c69d (diff) | |
| download | abridge-2d0788c3981328f1fbd9de4274d2925bf9586e03.tar.gz abridge-2d0788c3981328f1fbd9de4274d2925bf9586e03.tar.bz2 abridge-2d0788c3981328f1fbd9de4274d2925bf9586e03.zip | |
Add multi-lingual Support
Diffstat (limited to 'templates/macros/macros.html')
| -rw-r--r-- | templates/macros/macros.html | 30 |
1 files changed, 23 insertions, 7 deletions
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 %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{%- endif %} {#- Date #} - {%- if config.extra.meta_post.date %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif %} {{ page.date | date(format="%B %d, %Y") }} + {%- 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 = 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 %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{% endif %} {#- Categories #} - {%- if page.taxonomies.categories %} {%- if config.extra.icon_info %}<i class="{{ config.extra.icon_info }}"></i> {% endif %} [{% for cat in page.taxonomies.categories %}<a href="{{ get_taxonomy_url(kind='categories', name=cat) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ cat }}</a>{% endfor %}]{% endif %} + {%- if page.taxonomies.categories %} {%- if config.extra.icon_info %}<i class="{{ config.extra.icon_info }}"></i> {% endif %} [{% for cat in page.taxonomies.categories %}<a href="{{ get_taxonomy_url(kind='categories', name=cat, lang=lang) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ cat }}</a>{% endfor %}]{% endif %} {#- Tags #} - {%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #<a href="{{ get_taxonomy_url(kind='tags', name=tag) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ tag }}</a> {% endfor -%}{%- endif %}</span> + {%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #<a href="{{ get_taxonomy_url(kind='tags', name=tag, lang=lang) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ tag }}</a> {% endfor -%}{%- endif %}</span> {%- 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 %} - <a href="{{ get_taxonomy_url(kind='authors', name=author) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ author }}</a> + <a href="{{ get_taxonomy_url(kind='authors', name=author, lang=lang) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ author }}</a> {%- 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 %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{%- endif %} {#- Date #} - {%- if config.extra.meta_index.date %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif %} {{ page.date | date(format="%B %d, %Y") }} + {%- 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 = 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 %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{% endif %} {#- Categories #} - {%- if page.taxonomies.categories %} {%- if config.extra.icon_info %}<i class="{{ config.extra.icon_info }}"></i> {% endif %} [{% for cat in page.taxonomies.categories %}<a href="{{ get_taxonomy_url(kind='categories', name=cat) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ cat }}</a>{% endfor %}]{% endif %} + {%- if page.taxonomies.categories %} {%- if config.extra.icon_info %}<i class="{{ config.extra.icon_info }}"></i> {% endif %} [{% for cat in page.taxonomies.categories %}<a href="{{ get_taxonomy_url(kind='categories', name=cat, lang=lang) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ cat }}</a>{% endfor %}]{% endif %} {#- Tags #} - {%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #<a href="{{ get_taxonomy_url(kind='tags', name=tag) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ tag }}</a> {% endfor -%}{%- endif %}</span> + {%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #<a href="{{ get_taxonomy_url(kind='tags', name=tag, lang=lang) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ tag }}</a> {% endfor -%}{%- endif %}</span> {%- endmacro meta_index %} |
