Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.2.X] Fixed #14126 -- Fixed an issue with changes to the blocktrans…

… tag introduced in r13973 related to multiple plural forms. Thanks, mark0978, svetlyak40wt and Ramiro.

Backport from trunk (r14239).

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14240 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 11713a8771221767f31718ef6406d276b435b9b0 1 parent 386b681
Jannis Leidel authored October 16, 2010
3  django/templatetags/i18n.py
@@ -78,8 +78,7 @@ def render(self, context):
78 78
             context[self.countervar] = count
79 79
             plural, plural_vars = self.render_token_list(self.plural)
80 80
             result = translation.ungettext(singular, plural, count)
81  
-            if count != 1:
82  
-                vars = plural_vars
  81
+            vars.extend(plural_vars)
83 82
         else:
84 83
             result = translation.ugettext(singular)
85 84
         # Escape all isolated '%' before substituting in the context.
3  tests/regressiontests/templates/tests.py
@@ -1119,6 +1119,9 @@ def get_template_tests(self):
1119 1119
             # translation of plural form with extra field in singular form (#13568)
1120 1120
             '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"),
1121 1121
 
  1122
+            # translation of singular form in russian (#14126)
  1123
+            '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'),
  1124
+
1122 1125
             ### HANDLING OF TEMPLATE_STRING_IF_INVALID ###################################
1123 1126
 
1124 1127
             'invalidstr01': ('{{ var|default:"Foo" }}', {}, ('Foo','INVALID')),

0 notes on commit 11713a8

Please sign in to comment.
Something went wrong with that request. Please try again.