diff --git a/django/core/template.py b/django/core/template.py index df0e1083c4..d23e3f6a71 100644 --- a/django/core/template.py +++ b/django/core/template.py @@ -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) diff --git a/tests/othertests/templates.py b/tests/othertests/templates.py index 509aa29a3e..9b70230537 100644 --- a/tests/othertests/templates.py +++ b/tests/othertests/templates.py @@ -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.