Opened 8 years ago

Closed 6 years ago

Last modified 5 years ago

#9988 closed (fixed)

Make it possible to handle translation contexts

Reported by: Stephane Raimbault Owned by: nobody
Component: Internationalization Version: master
Severity: Keywords: french i18n-nofix
Cc: claude@…, s.kuzmenko@…, bronger@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The file utils/date.py contains the following strings:
MONTHS = {

1:_('January'), 2:_('February'), 3:_('March'), 4:_('April'), 5:_('May'), 6:_('June'),
7:_('July'), 8:_('August'), 9:_('September'), 10:_('October'), 11:_('November'),
12:_('December')

}

MONTHS_AP = { # month names in Associated Press style

1:_('Jan.'), 2:_('Feb.'), 3:_('March'), 4:_('April'), 5:_('May'), 6:_('June'), 7:_('July'),
8:_('Aug.'), 9:_('Sept.'), 10:_('Oct.'), 11:_('Nov.'), 12:_('Dec.')

}

so there is only one string for 'July' in the PO file and it's not possible to have a contextual translation.
For example, in French, the first translation is 'Juillet' and the second one for AP is 'Juil.'.

The solution depends on http://bugs.python.org/issue2504

Attachments (3)

pgettext.patch (6.9 KB) - added by Claude Paroz 6 years ago.
pgettext implementation
pgettext-2.patch (11.7 KB) - added by Claude Paroz 6 years ago.
pgettext implementation including js and docs
months_ap_pgettext.patch (1.3 KB) - added by Claude Paroz 6 years ago.
Add context to MONTHS_AP dict strings

Download all attachments as: .zip

Change History (20)

comment:1 Changed 8 years ago by Malcolm Tredinnick

Component: TranslationsInternationalization
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

comment:2 Changed 8 years ago by Jacob

Triage Stage: UnreviewedDesign decision needed

comment:3 Changed 7 years ago by Marc Garcia

Keywords: i18n-nofix added

comment:4 Changed 7 years ago by Ramiro Morales

[12296] is a first step in this direction.

comment:5 Changed 7 years ago by Ramiro Morales

Summary: It's not possible to correctly translate the monthsMake it possible to handle translation contexts

See related django-i18n thread.

comment:6 Changed 6 years ago by Jannis Leidel

Triage Stage: Design decision neededAccepted

Changed 6 years ago by Claude Paroz

Attachment: pgettext.patch added

pgettext implementation

comment:7 Changed 6 years ago by Jannis Leidel

milestone: 1.3

comment:8 Changed 6 years ago by Claude Paroz

I just attached a patch to implement pgettext for Django (same patch uploaded on #11686). This would be the foundation needed to resolve this issue.

Changed 6 years ago by Claude Paroz

Attachment: pgettext-2.patch added

pgettext implementation including js and docs

Changed 6 years ago by Claude Paroz

Attachment: months_ap_pgettext.patch added

Add context to MONTHS_AP dict strings

comment:9 Changed 6 years ago by Claude Paroz

Cc: claude@… added
Has patch: set

comment:10 Changed 6 years ago by anonymous

Cc: s.kuzmenko@… added

comment:11 Changed 6 years ago by Claude Paroz

Note that Catalan translations will have to be updated after the MONTHS_AP patch so as regressiontests.i18n.tests.FormattingTests still pass successfully.

comment:12 Changed 6 years ago by Torsten Bronger

Cc: bronger@… added

comment:13 Changed 6 years ago by Jannis Leidel

Resolution: fixed
Status: newclosed

(In [14450]) Fixed #9988 -- Added support for translation contexts. Thanks, Claude Paroz.

comment:14 Changed 6 years ago by Jannis Leidel

(In [14899]) Fixed #14570 -- Added new date format character for alternative month names using the new context capabilities. Also add context to Associated Press style month names (refs #9988). Thanks to Claude and shell_dweller.

comment:15 Changed 6 years ago by Claude Paroz

Resolution: fixed
Status: closedreopened

I'm reopening the ticket, because the latest patch which fixes the main issue of the original ticket is still not committed.

comment:16 Changed 6 years ago by Jannis Leidel

Resolution: fixed
Status: reopenedclosed

(In [15280]) Fixed #9988 (again) -- Updated list of Associated Press months names to use a translation context. Thanks, Claude Paroz.

comment:17 Changed 5 years ago by Jacob

milestone: 1.3

Milestone 1.3 deleted

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