mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +00:00
i18n: i18n string resolution now does string interpolation against the context, too
git-svn-id: http://code.djangoproject.com/svn/django/branches/i18n@761 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
ae3c26df62
commit
009694db63
@ -418,7 +418,7 @@ def resolve_variable(path, context):
|
||||
if path[0] in ('"', "'") and path[0] == path[-1]:
|
||||
current = path[1:-1]
|
||||
elif path.startswith('_(') and path.endswith(')') and path[2] in ("'", '"') and path[-2] == path[2]:
|
||||
current = _(path[3:-2])
|
||||
current = _(path[3:-2]) % context
|
||||
else:
|
||||
current = context
|
||||
bits = path.split(VARIABLE_ATTRIBUTE_SEPARATOR)
|
||||
|
@ -244,6 +244,9 @@ TEMPLATE_TESTS = {
|
||||
|
||||
# translation of string without i18n tag
|
||||
'i18n11': ('{{ _("blah") }}', {}, "blah"),
|
||||
|
||||
# translation of string without i18n tag but with interpolation
|
||||
'i18n12': ('{{ _("blah%(anton)s") }}', {'anton': 'blubb'}, "blahblubb"),
|
||||
}
|
||||
|
||||
# This replaces the standard template_loader.
|
||||
|
Loading…
x
Reference in New Issue
Block a user