Opened 6 years ago

Closed 4 years ago

Last modified 4 years ago

#9988 closed (fixed)

Make it possible to handle translation contexts

Reported by: stephaner 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 claudep 5 years ago.
pgettext implementation
pgettext-2.patch (11.7 KB) - added by claudep 5 years ago.
pgettext implementation including js and docs
months_ap_pgettext.patch (1.3 KB) - added by claudep 5 years ago.
Add context to MONTHS_AP dict strings

Download all attachments as: .zip

Change History (20)

comment:1 Changed 6 years ago by mtredinnick

  • Component changed from Translations to Internationalization
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 6 years ago by jacob

  • Triage Stage changed from Unreviewed to Design decision needed

comment:3 Changed 6 years ago by garcia_marc

  • Keywords i18n-nofix added

comment:4 Changed 5 years ago by ramiro

[12296] is a first step in this direction.

comment:5 Changed 5 years ago by ramiro

  • Summary changed from It's not possible to correctly translate the months to Make it possible to handle translation contexts

See related django-i18n thread.

comment:6 Changed 5 years ago by jezdez

  • Triage Stage changed from Design decision needed to Accepted

Changed 5 years ago by claudep

pgettext implementation

comment:7 Changed 5 years ago by jezdez

  • milestone set to 1.3

comment:8 Changed 5 years ago by claudep

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 5 years ago by claudep

pgettext implementation including js and docs

Changed 5 years ago by claudep

Add context to MONTHS_AP dict strings

comment:9 Changed 5 years ago by claudep

  • Cc claude@… added
  • Has patch set

comment:10 Changed 5 years ago by anonymous

  • Cc s.kuzmenko@… added

comment:11 Changed 5 years ago by claudep

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 5 years ago by bronger

  • Cc bronger@… added

comment:13 Changed 5 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:14 Changed 5 years ago by jezdez

(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 4 years ago by claudep

  • Resolution fixed deleted
  • Status changed from closed to reopened

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 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from reopened to closed

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

comment:17 Changed 4 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

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