﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
20383	Makemessages must deal with context translations for a limited set of contexts.	Filipe Waitman <filwaitman@…>	nobody	"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?"	New feature	closed	Translations	1.4	Normal	wontfix			Unreviewed	0	0	0	0	0	0
