Opened 2 years ago

Closed 2 years ago

#33661 closed Bug (fixed)

Fix Catalan formats.py to use alt.month

Reported by: mpachas Owned by: mpachas
Component: Internationalization Version: 4.0
Severity: Normal Keywords: date, template, i18n
Cc: Carlton Gibson Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by mpachas)

DATE_FORMAT, DATETIME_FORMAT and MONTH_DAY_FORMAT strings in Catalan language are wrong because it uses always the preposition "de" between the day number and the month name but it is wrong when the month name starts with vowel like abril (April), agost (August) or octubre (October). In that case it should be d'abril, d'agost or d'octubre.

I think that alt.month Month translations were created to help in this kind of situations (https://github.com/django/django/commit/2478f8588e) so this issue can be solved by a combination of a Catalan formats.py patch (django/conf/locale/ca/formats.py) and changing that translations (via Transifex).

Actual:
DATE_FORMAT = r"j \d\e F \d\e Y"

msgid "January"
msgstr "gener"

msgid "April"
msgstr "abril"

{item.date | date} output -> 25 de gener de 2007
{item.date | date} output -> 4 de abril de 2014 ---> THIS IS WRONG

Proposal:

DATE_FORMAT = r"j E \d\e Y" # E placeholder: alt. month translations for special cases.

msgctxt "alt. month"
msgid "January"
msgstr "de gener"

msgctxt "alt. month"
msgid "April"
msgstr "d'abril"

{item.date | date} output -> 25 de gener de 2007
{item.date | date} output -> 4 d'abril de 2014

I'm trying to reach Catalan Transifex Team to add those strings, I think .po/.mo files won't follow the usual pull request way, but they must be changed before this file gets patched.

Alternative month representation is available since this https://code.djangoproject.com/ticket/12309#no1

Patch: https://github.com/django/django/pull/15634

Attachments (2)

patch.patch (725 bytes ) - added by mpachas 2 years ago.
patch file for formats.py
patch.diff (725 bytes ) - added by mpachas 2 years ago.
patch with .diff extension

Download all attachments as: .zip

Change History (12)

by mpachas, 2 years ago

Attachment: patch.patch added

patch file for formats.py

comment:1 by mpachas, 2 years ago

Owner: changed from nobody to mpachas
Status: newassigned

by mpachas, 2 years ago

Attachment: patch.diff added

patch with .diff extension

comment:2 by Carlton Gibson, 2 years ago

Triage Stage: UnreviewedAccepted

Hi, thanks for the report.

… it is wrong when the month name starts with vowel like abril (April), agost (August) or octubre (October). In that case it should be d'abril, d'agost or d'octubre.

Yep, OK.

Let's accept; without reviewing fully, your explanation that we need to update the formats sounds likely.

Are you able to open a PR on GitHub with your patch? https://github.com/django/django/pulls

Moltes gràcies!

comment:3 by Carlton Gibson, 2 years ago

Cc: Carlton Gibson added

in reply to:  3 ; comment:4 by mpachas, 2 years ago

Replying to Carlton Gibson:

I will open a PR as soon as we update django.po and django.mo for Catalan. Otherwise, if the PR gets merged without the translations update then DATE_FORMAT, DATETIME_FORMAT and MONTH_DAY_FORMAT will show an incomplete format for all months instead of a wrong format for 3 months.

If you think I should open it anyway, please tell me. Thanks.

in reply to:  4 ; comment:5 by Carlton Gibson, 2 years ago

Replying to mpachas:

Yes, I would open it anyway: it's easier to work with PRs than patch files (if only that we're already there, and seeing it in our list…)
Thanks

comment:6 by mpachas, 2 years ago

Description: modified (diff)

in reply to:  5 comment:7 by mpachas, 2 years ago

Replying to Carlton Gibson:

Replying to mpachas:

Yes, I would open it anyway: it's easier to work with PRs than patch files (if only that we're already there, and seeing it in our list…)
Thanks

PR available at https://github.com/django/django/pull/15634, I've just get in touch with aaloy as Transifex coordinator for Django translations in Catalan.

comment:8 by mpachas, 2 years ago

Description: modified (diff)

comment:9 by Carlton Gibson, 2 years ago

Triage Stage: AcceptedReady for checkin

comment:10 by Carlton Gibson <carlton.gibson@…>, 2 years ago

Resolution: fixed
Status: assignedclosed

In aa28c392:

Fixed #33661 -- Corrected Catalan date-format localization.

Changed DATE_FORMAT, DATETIME_FORMAT and MONTH_DAY_FORMAT
to use E placeholder (Month, locale specific alternative)
to handle both “de gener” and contracted “d’abril” cases.

Thanks to Ferran Jovell for review.

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