#20383: Makemessages must deal with context translations for a limited set of
contexts.
-----------------------------------------------+--------------------
     Reporter:  Filipe Waitman <filwaitman@…>  |      Owner:  nobody
         Type:  New feature                    |     Status:  new
    Component:  Translations                   |    Version:  1.4
     Severity:  Normal                         |   Keywords:
 Triage Stage:  Unreviewed                     |  Has patch:  0
Easy pickings:  0                              |      UI/UX:  0
-----------------------------------------------+--------------------
 Hi everyone.


 Django `makemessages` works fine when you define categorically a context
 to be used as a string, like

 {{{
 translated_message = pgettext('my_context', 'Hello World!')
 }}}


 But it can not "guess" your context when it's a variable (fair enough -
 when you have a variable with infinite possible values), like:

 {{{
 translated_message = pgettext(my_context_var, 'Hello World!')
 }}}


 However, I am working in a project that we have a limited set of contexts
 (in a white-label software where each context is a brand).
 Given it is a limited set of contexts I think Django can understand this
 and generate translation messages with each one of these contexts.


 Use case example: I have basically 3 values for contexts (for instance:
 "AAA", "BBB" and "CCC").
 Sometimes, I have to use things like

 {{{
 translated_message = pgettext(CURRENT_CONTEXT, 'Hello World!')
 }}}

 Would be great if when Django `makemessages` find a variable as the
 context, it generated one message for each possible context, as follows:

 {{{
 msgctxt "AAA"
 msgid "Hello World!"
 msgstr ""

 msgctxt "BBB"
 msgid "Hello World!"
 msgstr ""

 msgctxt "CCC"
 msgid "Hello World!"
 msgstr ""
 }}}

 The list of possible context to be used could be configured in the
 settings file, as follows:

 {{{
 # settings.py
 TRANSLATION_CONTEXTS = (
     'AAA',
     'BBB',
     'CCC',
 )
 }}}

 Does anyone else think this is a good feature to be added? Any predicted
 backwards incompatibility?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20383>
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 post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to