Ticket #14126: blocktrans.diff
File blocktrans.diff, 1.7 KB (added by , 14 years ago) |
---|
-
django/templatetags/i18n.py
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. -
tests/regressiontests/templates/tests.py
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 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')),