Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#11686 closed (wontfix)

Support for gettext's contexts

Reported by: mitar Owned by: nobody
Component: Internationalization Version: 1.1
Severity: Keywords:
Cc: mmitar@…, bronger@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


For languages where translations change based on context (like number, gender, tense, case) it would be great if Django would support gettext's context as a parameter to ugettext and others.

And then if admin app would use this. :-)

Attachments (1)

pgettext.patch (6.9 KB) - added by claudep 6 years ago.
pgettext implementation

Download all attachments as: .zip

Change History (7)

comment:1 Changed 7 years ago by ubernostrum

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

This is not possible at present, as Python's gettext module does not provide an equivalent to GNU pgettext.

comment:2 Changed 7 years ago by mitar

Just for the record, there exists a ticket for this on a Python tracker and it seems it will be included.

There is no future milestones which would be a place for tickets which are valid but not yet possible?

comment:3 Changed 7 years ago by ramiro


So, I'd say this would be (or at least has been) in the plans of a core developer for 1.2. A champion that implements (and commits to take care of) a patch for review attaching it to this (reopened) ticket plus adding the feature to the Version1.2Features list would increase the chances of something like this being added to Django.

Leaving this ticket closed as it has been set so by a core developer.

comment:4 Changed 6 years ago by bronger

  • Cc bronger@… added

Changed 6 years ago by claudep

pgettext implementation

comment:5 Changed 6 years ago by claudep

  • Has patch set
  • Needs documentation set

I'd like to reopen this, see the attached patch (note I didn't include tests/regressiontests/i18n/other/locale/de/LC_MESSAGES/ has it contains binary data, just msgfmt it from the django.po).

The Python issue is still pending, and as it will probably never reach the 2.x Python codebase, I think it's worth to be implemented in Django itself. Other bugs are depending on this (e.g. #9988, #14570, ...).
I took some inspiration from

I'm OK to write docs as soon as it is accepted.

comment:6 Changed 6 years ago by jezdez

FYI, further progress to #9988.

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