Skip to content

Commit

Permalink
Fixed #14126 -- Fixed an issue with changes to the blocktrans tag int…
Browse files Browse the repository at this point in the history
…roduced in r13967 related to multiple plural forms. Thanks, mark0978, svetlyak40wt and Ramiro.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14239 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
jezdez committed Oct 16, 2010
1 parent 58e3849 commit d931f43
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 1 addition & 2 deletions django/templatetags/i18n.py
Expand Up @@ -78,8 +78,7 @@ def render(self, context):
context[self.countervar] = count
plural, plural_vars = self.render_token_list(self.plural)
result = translation.ungettext(singular, plural, count)
if count != 1:
vars = plural_vars
vars.extend(plural_vars)
else:
result = translation.ugettext(singular)
# Escape all isolated '%' before substituting in the context.
Expand Down
3 changes: 3 additions & 0 deletions tests/regressiontests/templates/tests.py
Expand Up @@ -1119,6 +1119,9 @@ def get_template_tests(self):
# translation of plural form with extra field in singular form (#13568)
'i18n26': ('{% load i18n %}{% blocktrans with myextra_field as extra_field count number as counter %}singular {{ extra_field }}{% plural %}plural{% endblocktrans %}', {'number': 1, 'myextra_field': 'test'}, "singular test"),

# translation of singular form in russian (#14126)
'i18n27': ('{% load i18n %}{% blocktrans count number as counter %}1 result{% plural %}{{ counter }} results{% endblocktrans %}', {'number': 1, 'LANGUAGE_CODE': 'ru'}, u'1 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442'),

### HANDLING OF TEMPLATE_STRING_IF_INVALID ###################################

'invalidstr01': ('{{ var|default:"Foo" }}', {}, ('Foo','INVALID')),
Expand Down

0 comments on commit d931f43

Please sign in to comment.