Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localization: Date format in header should be locale dependent #5059

vaclavstepan opened this issue Aug 26, 2021 · 3 comments · Fixed by #5071

Localization: Date format in header should be locale dependent #5059

vaclavstepan opened this issue Aug 26, 2021 · 3 comments · Fixed by #5071


Copy link

Describe the bug
Currently, in event header, the date is formatted using the format_event_date macro.
This macro relies on English locale custom for formatting the event date, which may not be OK for non-English languages.

To Reproduce
Steps to reproduce the behavior:

  1. Go to main page of an event.
  2. Switch to a different language
  3. See the date format in the event header stay the same, e.g. 1-13 listopada for Polish.

Expected behavior
The date format should reflect the language, e.g. probably be set by a translation template.
For Czech it would be 12.–14. září (for example).

Additional context
The macro in question is in modules/events/templates/display/conference/_util.html

Copy link

So what we have there is this:

    {% if == %}
        {{ start_dt | format_date('long') }}
    {% elif start_dt.year == end_dt.year and start_dt.month == end_dt.month %}
        {{ }}-{{ }} {{ start_dt | format_date('MMMM yyyy') }}
    {% else %}
        {% trans start=start_dt|format_date('long'), end=end_dt|format_date('long') -%}
            {{ start }} to {{ end }}
        {%- endtrans %}
    {% endif %}

I guess the MMMM yyyy should be made translatable - everything else seems to be OK since it's using locale-dependent translation? Or would you need {{ }}-{{ }} to be translatabel as well in order to add the . after the days?

Copy link
Contributor Author

Yes, format_date('long') is fine, only the line with and does not work well.
{{ }}-{{ }} {{ start_dt | format_date('MMMM yyyy') }}

has trouble that it's not using the localized form for the days - in Czech it would be 1.–2. month year, so the dots are needed.
In Czech it would work if one would take the day part from a long format, add dash, then long format for the end date.
I'm not fully sure if this is generally true/enough.

Copy link
Contributor Author

vaclavstepan commented Sep 1, 2021

Similarly there are hardcoded/non-localized date formats in two files in indico/legacy/pdfinterface/latex_templates, the abstract.tex and first_page.tex. Probably all the strftime uses are possibly a trouble.

@ThiefMaster ThiefMaster added this to the v3 milestone Sep 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging a pull request may close this issue.

2 participants