forked from deepStateMirrors/tabi
✨ feat: add per-language date format configuration (#556)
This commit is contained in:
parent
3a40ae5a83
commit
2064beae78
9 changed files with 115 additions and 7 deletions
|
@ -3,7 +3,23 @@
|
|||
{#- Set locale -#}
|
||||
{%- set date_locale = macros_translate::translate(key="date_locale", default="en_GB", language_strings=language_strings) -%}
|
||||
|
||||
{%- if config.extra.short_date_format and short -%}
|
||||
{#- Check for language-specific date formats -#}
|
||||
{%- set language_format = "" -%}
|
||||
{%- if config.extra.date_formats -%}
|
||||
{%- for format_config in config.extra.date_formats -%}
|
||||
{%- if format_config.lang == lang -%}
|
||||
{%- if short and format_config.short -%}
|
||||
{%- set_global language_format = format_config.short -%}
|
||||
{%- elif not short and format_config.long -%}
|
||||
{%- set_global language_format = format_config.long -%}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if language_format -%}
|
||||
{{ date | date(format=language_format, locale=date_locale) }}
|
||||
{%- elif config.extra.short_date_format and short -%}
|
||||
{{ date | date(format=config.extra.short_date_format, locale=date_locale) }}
|
||||
{%- elif config.extra.long_date_format and not short -%}
|
||||
{{ date | date(format=config.extra.long_date_format, locale=date_locale) }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue