#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 , 15 months ago
Cc: | added |
---|
comment:2 by , 15 months ago
Cc: | added |
---|
comment:3 by , 15 months ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:4 by , 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.
comment:6 by , 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 , 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.
comment:8 by , 15 months ago
Has patch: | set |
---|
Suggested PR. This would need confirmation by Belgian/Canadian French speakers.
comment:9 by , 15 months ago
Owner: | changed from | to
---|---|
Patch needs improvement: | set |
Status: | new → assigned |
Waiting for fr_CA
formats.
comment:11 by , 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 , 15 months ago
I don't think any decision has to be made. It's a matter of finishing the patch.
comment:13 by , 15 months ago
Triage Stage: | Accepted → Ready for checkin |
---|
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)