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`":
{{{
#!python
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())`
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34784>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: Claude Paroz (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/34784#comment:1>
* cc: Stephane Raimbault (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/34784#comment:2>
* stage: Unreviewed => Accepted
Comment:
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)
--
Ticket URL: <https://code.djangoproject.com/ticket/34784#comment:3>
Comment (by Olivier Pons):
Perhaps the official version is "`d.m.Y`" – I haven't really checked
precisely. It will always be better than the current version.
--
Ticket URL: <https://code.djangoproject.com/ticket/34784#comment:4>
Comment (by Claude Paroz):
No, we have to differentiate between fr (or fr_FR) and fr_CH/fr_BE.
--
Ticket URL: <https://code.djangoproject.com/ticket/34784#comment:5>
Comment (by Amir Karimi):
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/34784#comment:6>
Comment (by Olivier Pons):
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` version from "`j N Y`" to
"`d/m/Y`". Doing so should resolve the issue."
--
Ticket URL: <https://code.djangoproject.com/ticket/34784#comment:7>
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/17187 Suggested PR]. This would
need confirmation by Belgian/Canadian French speakers.
--
Ticket URL: <https://code.djangoproject.com/ticket/34784#comment:8>
* owner: nobody => Claude Paroz
* needs_better_patch: 0 => 1
* status: new => assigned
Comment:
Waiting for `fr_CA` formats.
--
Ticket URL: <https://code.djangoproject.com/ticket/34784#comment:9>
* needs_better_patch: 1 => 0
Comment:
Submitted the fr_CA variant.
--
Ticket URL: <https://code.djangoproject.com/ticket/34784#comment:10>
Comment (by Olivier Pons):
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?
--
Ticket URL: <https://code.djangoproject.com/ticket/34784#comment:11>
Comment (by Claude Paroz):
I don't think any decision has to be made. It's a matter of finishing the
patch.
--
Ticket URL: <https://code.djangoproject.com/ticket/34784#comment:12>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/34784#comment:13>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"1ac397674b2f64d48e66502a20b9d9ca6bfb579a" 1ac39767]:
{{{
#!CommitTicketReference repository=""
revision="1ac397674b2f64d48e66502a20b9d9ca6bfb579a"
Refs #34784 -- Added fr_CA locale formats.
Formating rules sourced from
- https://www.btb.termiumplus.gc.ca/tpv2guides/guides/clefsfp/index-
fra.html?lang=fra&lettr=indx_catlog_d&page=9lcOojjUrxt8.html
- https://vitrinelinguistique.oqlf.gouv.qc.ca/21241/la-typographie/nombres
/ecriture-des-dates-et-des-heures-dans-certains-contextes-techniques
- https://en.wikipedia.org/wiki/Date_and_time_notation_in_Canada
- https://metacpan.org/dist/DateTime-
Locale/view/lib/DateTime/Locale/fr_CA.pod
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34784#comment:15>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"fdf14cfc01558bfa6f990560d38531c82fb5c024" fdf14cf]:
{{{
#!CommitTicketReference repository=""
revision="fdf14cfc01558bfa6f990560d38531c82fb5c024"
Fixed #34784 -- Adjusted SHORT_DATE_FORMAT in various French variants.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34784#comment:14>