diff options
| author | Claude Paroz <claude@2xlibre.net> | 2012-10-15 10:00:22 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2012-10-15 10:00:22 +0200 |
| commit | afbf913b90a820702a2a4cad669c25d8808a5843 (patch) | |
| tree | d309b64e63c8e956ef0b4c0e751da32a22ecd328 | |
| parent | a451d2b4a21af062bd1295f71ae62ef770963d4f (diff) | |
Build context strings out of [u|n]gettext
The context strings in [n]pgettext functions should not be marked
themselves for translation.
| -rw-r--r-- | django/utils/translation/trans_real.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py index 6911c2c723..cce2a8cb86 100644 --- a/django/utils/translation/trans_real.py +++ b/django/utils/translation/trans_real.py @@ -273,7 +273,8 @@ else: return do_translate(message, 'ugettext') def pgettext(context, message): - result = ugettext("%s%s%s" % (context, CONTEXT_SEPARATOR, message)) + msg_with_ctxt = "%s%s%s" % (context, CONTEXT_SEPARATOR, message) + result = ugettext(msg_with_ctxt) if CONTEXT_SEPARATOR in result: # Translation not found result = message @@ -319,9 +320,10 @@ else: return do_ntranslate(singular, plural, number, 'ungettext') def npgettext(context, singular, plural, number): - result = ungettext("%s%s%s" % (context, CONTEXT_SEPARATOR, singular), - "%s%s%s" % (context, CONTEXT_SEPARATOR, plural), - number) + msgs_with_ctxt = ("%s%s%s" % (context, CONTEXT_SEPARATOR, singular), + "%s%s%s" % (context, CONTEXT_SEPARATOR, plural), + number) + result = ungettext(*msgs_with_ctxt) if CONTEXT_SEPARATOR in result: # Translation not found result = ungettext(singular, plural, number) |
