1
0
mirror of https://github.com/django/django.git synced 2025-07-04 01:39:20 +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:
Georg Bauer 2005-10-01 16:35:20 +00:00
parent ae3c26df62
commit 009694db63
2 changed files with 4 additions and 1 deletions

View File

@ -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)

View File

@ -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.