♻️ refactor(translation): introduce translation macro (#129)

This commit is contained in:
Óscar
2023-09-01 23:29:11 +02:00
committed by GitHub
parent 3344f80539
commit 78f97e17b4
18 changed files with 74 additions and 103 deletions

View File

@@ -1,11 +1,7 @@
{% macro format_date(date, short) %}
{# Set locale #}
{%- if lang != config.default_language %}
{% set date_locale = trans(key="date_locale" | safe, lang=lang) %}
{% else %}
{% set date_locale = "en_GB" %}
{% endif %}
{% set date_locale = macros_translate::translate(key="date_locale", default="en_GB") %}
{% if config.extra.short_date_format and short %}
{{ date | date(format=config.extra.short_date_format, locale=date_locale) }}