diff options
| author | Georg Bauer <gb@hugo.westfalen.de> | 2005-10-01 16:35:20 +0000 |
|---|---|---|
| committer | Georg Bauer <gb@hugo.westfalen.de> | 2005-10-01 16:35:20 +0000 |
| commit | 009694db63b8c3d30dc4f07110169c4bf48a3de6 (patch) | |
| tree | c85a95f75a63d99ffd9e8da5a38694ba293de133 | |
| parent | ae3c26df6250ba4a2bd0bbd27f499eb211df9f15 (diff) | |
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
| -rw-r--r-- | django/core/template.py | 2 | ||||
| -rw-r--r-- | tests/othertests/templates.py | 3 |
2 files changed, 4 insertions, 1 deletions
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. |
