summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2010-10-01 02:02:01 +0000
committerJannis Leidel <jannis@leidel.info>2010-10-01 02:02:01 +0000
commita64e96c227b36c701a86ded75d839b1cd2442713 (patch)
tree275bcb46c02809cc7475ee81c9dea0e9bcbbabd2 /django
parent8e301812fa6349b410db44fd4d6fe1df388635c3 (diff)
Fixed #13568 -- Fixed the blocktrans tag to not raise a KeyError if the number of variables in the singular and the plural block differ. Thanks, deloide.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13967 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/templatetags/i18n.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/templatetags/i18n.py b/django/templatetags/i18n.py
index 10ac900041..c4dd2e7835 100644
--- a/django/templatetags/i18n.py
+++ b/django/templatetags/i18n.py
@@ -76,8 +76,10 @@ class BlockTranslateNode(Node):
if self.plural and self.countervar and self.counter:
count = self.counter.resolve(context)
context[self.countervar] = count
- plural, vars = self.render_token_list(self.plural)
+ plural, plural_vars = self.render_token_list(self.plural)
result = translation.ungettext(singular, plural, count)
+ if count != 1:
+ vars = plural_vars
else:
result = translation.ugettext(singular)
# Escape all isolated '%' before substituting in the context.