Opened 15 months ago

Closed 15 months ago

Last modified 15 months ago

#34784 closed Bug (fixed)

Django french short date format translation bug

Reported by: Olivier Pons Owned by: Claude Paroz
Component: Internationalization Version: 4.2
Severity: Normal Keywords: translation, french, date
Cc: Claude Paroz, Stephane Raimbault Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This bug has persisted for over 8 years:

English: SHORT_DATE_FORMAT = "m/d/Y"

In French, it should be: SHORT_DATE_FORMAT = "d/m/Y"

However, it's currently set to: SHORT_DATE_FORMAT = "j N Y"

This results in an incorrect translation:

For English: "08/18/2023" should translate to "18/08/2023" for a "short" format.

But as it stands now:
English: "08/18/2023" translates to "18 août 2023", which is not an expected short date format.

As a workaround, we're using Babel, which returns the correct short version = "d/m/Y":

from datetime import date
from babel.dates import format_date
from django.utils.translation import get_language

formatted_date = format_date(date.today(), "short", locale=get_language())`

Change History (15)

comment:1 by Mariusz Felisiak, 15 months ago

Cc: Claude Paroz added

comment:2 by Mariusz Felisiak, 15 months ago

Cc: Stephane Raimbault added

comment:3 by Claude Paroz, 15 months ago

Triage Stage: UnreviewedAccepted

Makes sense. However, as the real short format is different at least between fr_FR (d/m/Y), fr_CH (d.m.Y), and fr_BE (d.m.Y), a proper resolution would be to provide formats.py-only specific locale for fr_CH and fr_BE. (this may be the reason for the current value)

comment:4 by Olivier Pons, 15 months ago

Perhaps the official version is "d.m.Y" – I haven't really checked precisely. It will always be better than the current version. This would standardize and have only one language for the three "fr".

Last edited 15 months ago by Olivier Pons (previous) (diff)

comment:5 by Claude Paroz, 15 months ago

No, we have to differentiate between fr (or fr_FR) and fr_CH/fr_BE.

comment:6 by Amir Karimi, 15 months ago

So, it seems if we just copy fr folder and paste it as fr_CH like what we have done for es, and just separate fr_CH/BE from fr, it will be resolved.

comment:7 by Olivier Pons, 15 months ago

We should not only copy the fr folder and rename it as fr_CH (like we did for es), and distinguish between fr_CH / fr_BE and fr, but also change the date format in the fr_FR (or perhaps fr; I'm sorry, I'm not well-versed in translation) version from "j N Y" to "d/m/Y". Doing so should resolve the issue.

Last edited 15 months ago by Olivier Pons (previous) (diff)

comment:8 by Claude Paroz, 15 months ago

Has patch: set

Suggested PR. This would need confirmation by Belgian/Canadian French speakers.

comment:9 by Mariusz Felisiak, 15 months ago

Owner: changed from nobody to Claude Paroz
Patch needs improvement: set
Status: newassigned

Waiting for fr_CA formats.

comment:10 by Simon Charette, 15 months ago

Patch needs improvement: unset

Submitted the fr_CA variant.

comment:11 by Olivier Pons, 15 months ago

Thank you for the detailed discussion on the date format variations across different French locales. I appreciate the insights. Which Belgian/Canadian French speakers are qualified and accredited to validate this ticket and provide a final decision on the proposed changes?

comment:12 by Claude Paroz, 15 months ago

I don't think any decision has to be made. It's a matter of finishing the patch.

comment:13 by Mariusz Felisiak, 15 months ago

Triage Stage: AcceptedReady for checkin

comment:14 by Mariusz Felisiak <felisiak.mariusz@…>, 15 months ago

Resolution: fixed
Status: assignedclosed

In fdf14cf:

Fixed #34784 -- Adjusted SHORT_DATE_FORMAT in various French variants.

Note: See TracTickets for help on using tickets.
Back to Top