diff options
Diffstat (limited to 'django')
| -rw-r--r-- | django/template/__init__.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/django/template/__init__.py b/django/template/__init__.py index 5c4ab3052a..ffdb4e4809 100644 --- a/django/template/__init__.py +++ b/django/template/__init__.py @@ -485,9 +485,14 @@ class FilterExpression(object): (token[:upto], token[upto:start], token[start:])) if var == None: var, constant, i18n_constant = match.group("var", "constant", "i18n_constant") - if i18n_constant: - var = '"%s"' % _(i18n_constant.replace(r'\"', '"')) - elif constant: + if i18n_constant is not None: + # Don't pass the empty string to gettext, because the empty + # string translates to meta information. + if i18n_constant == "": + var = '""' + else: + var = '"%s"' % _(i18n_constant.replace(r'\"', '"')) + elif constant is not None: var = '"%s"' % constant.replace(r'\"', '"') upto = match.end() if var == None: |
