#34784: Django french short date format translation bug
-------------------------------------+-------------------------------------
Reporter: Olivier | Owner: nobody
Pons |
Type: Bug | Status: new
Component: | Version: 4.2
Internationalization | Keywords:
Severity: Normal | translation,french,date
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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`":
{{{
#!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.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018a08acf8db-3e6811e6-5257-49ae-b026-94c981739631-000000%40eu-central-1.amazonses.com.