Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions templates/_partials/fields/date.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,18 @@
{% endif %}

{% if not valueonly %}
{# Ensure we use only locales bundled with Flatflicker, otherwise default to 'en' #}
{% set locale = app.user.locale|split('_')|first %}
{% if not locale in 'ar|at|az|be|bg|bn|bs|cs|cy|da|de|eo|es|et|fa|fi|fo|fr|ga|gr|he|hi|hr|hu|id|is|it|ja|ka|km|ko|kz|lt|lv|mk|mn|ms|my|nl|no|pa|pl|pt|ro|ru|si|sk|sl|sq|sr|sv|th|tr|uk|uz|vn|zh'|split('|') %}
{% set locale = 'en' %}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bobdenotter is it an overkill to use the default locale, rather than en here? 🤔

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hardcoded it, because if the default locale would be nl_NL, it'll still break in that case.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good point! Agree!

{% endif %}
<editor-date
:value='{{ value|json_encode }}'
name='{{ name }}'
:readonly='{{ readonly|json_encode }}'
form='{{ form }}'
mode='{{ mode }}'
locale='{{app.user.locale}}'
locale='{{locale}}'
labels='{{ { 'toggle': 'editor_date.toggle'|trans }|json_encode }}'
:required='{{ required|json_encode }}'
:errormessage='{{ errormessage|json_encode }}'
Expand All @@ -39,6 +44,6 @@
{{ value|localdate(format|default(null), locale|default(null)) }}
<small>({{ macro.relative_datetime(value) }})</small>
{% endif %}

{% endblock %}