Author: jezdez
Date: 2010-10-16 15:51:06 -0500 (Sat, 16 Oct 2010)
New Revision: 14240

Modified:
   django/branches/releases/1.2.X/django/templatetags/i18n.py
   django/branches/releases/1.2.X/tests/regressiontests/templates/tests.py
Log:
[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).

Modified: django/branches/releases/1.2.X/django/templatetags/i18n.py
===================================================================
--- django/branches/releases/1.2.X/django/templatetags/i18n.py  2010-10-16 
20:40:17 UTC (rev 14239)
+++ django/branches/releases/1.2.X/django/templatetags/i18n.py  2010-10-16 
20:51:06 UTC (rev 14240)
@@ -78,8 +78,7 @@
             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.

Modified: 
django/branches/releases/1.2.X/tests/regressiontests/templates/tests.py
===================================================================
--- django/branches/releases/1.2.X/tests/regressiontests/templates/tests.py     
2010-10-16 20:40:17 UTC (rev 14239)
+++ django/branches/releases/1.2.X/tests/regressiontests/templates/tests.py     
2010-10-16 20:51:06 UTC (rev 14240)
@@ -1119,6 +1119,9 @@
             # 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')),

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to