1
0
mirror of https://github.com/django/django.git synced 2025-07-04 09:49:12 +00:00

i18n template tag now accepts varibles with filters or strings.

Variables with filters won't be pulled out for translation, of course, but
will just run the result of the filter through the translation engine.


git-svn-id: http://code.djangoproject.com/svn/django/branches/i18n@739 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Georg Bauer 2005-09-30 08:53:35 +00:00
parent f913e4d8c9
commit 80e450ee2d

View File

@ -303,7 +303,7 @@ class I18NNode(template.Node):
elif s.startswith('"') and s.endswith('"'):
s = s[1:-1]
else:
raise template.TemplateSyntaxError("i18n must be called as {% i18n _('some message') %}")
s = template.resolve_variable_with_filters(s, context)
return translation.gettext(s) % context
else:
raise template.TemplateSyntaxError("i18n must be called as {% i18n _('some message') %}")