mirror of
https://github.com/django/django.git
synced 2025-06-04 02:59:13 +00:00
Build context strings out of [u|n]gettext
The context strings in [n]pgettext functions should not be marked themselves for translation.
This commit is contained in:
parent
a451d2b4a2
commit
afbf913b90
@ -273,7 +273,8 @@ else:
|
|||||||
return do_translate(message, 'ugettext')
|
return do_translate(message, 'ugettext')
|
||||||
|
|
||||||
def pgettext(context, message):
|
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:
|
if CONTEXT_SEPARATOR in result:
|
||||||
# Translation not found
|
# Translation not found
|
||||||
result = message
|
result = message
|
||||||
@ -319,9 +320,10 @@ else:
|
|||||||
return do_ntranslate(singular, plural, number, 'ungettext')
|
return do_ntranslate(singular, plural, number, 'ungettext')
|
||||||
|
|
||||||
def npgettext(context, singular, plural, number):
|
def npgettext(context, singular, plural, number):
|
||||||
result = ungettext("%s%s%s" % (context, CONTEXT_SEPARATOR, singular),
|
msgs_with_ctxt = ("%s%s%s" % (context, CONTEXT_SEPARATOR, singular),
|
||||||
"%s%s%s" % (context, CONTEXT_SEPARATOR, plural),
|
"%s%s%s" % (context, CONTEXT_SEPARATOR, plural),
|
||||||
number)
|
number)
|
||||||
|
result = ungettext(*msgs_with_ctxt)
|
||||||
if CONTEXT_SEPARATOR in result:
|
if CONTEXT_SEPARATOR in result:
|
||||||
# Translation not found
|
# Translation not found
|
||||||
result = ungettext(singular, plural, number)
|
result = ungettext(singular, plural, number)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user