Ticket #13568: i18n_13568.diff
File i18n_13568.diff, 1.8 KB (added by , 14 years ago) |
---|
-
django/templatetags/i18n.py
76 76 if self.plural and self.countervar and self.counter: 77 77 count = self.counter.resolve(context) 78 78 context[self.countervar] = count 79 plural, vars = self.render_token_list(self.plural)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 83 else: 82 84 result = translation.ugettext(singular) 83 85 # Escape all isolated '%' before substituting in the context. -
tests/regressiontests/templates/tests.py
1104 1104 'i18n24': ("{% load i18n %}{% trans 'Page not found'|upper %}", {'LANGUAGE_CODE': 'de'}, u'SEITE NICHT GEFUNDEN'), 1105 1105 'i18n25': ('{% load i18n %}{% trans somevar|upper %}', {'somevar': 'Page not found', 'LANGUAGE_CODE': 'de'}, u'SEITE NICHT GEFUNDEN'), 1106 1106 1107 # translation of plural form with extra field in singular form (#XXX) 1108 '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"), 1109 1107 1110 ### HANDLING OF TEMPLATE_STRING_IF_INVALID ################################### 1108 1111 1109 1112 'invalidstr01': ('{{ var|default:"Foo" }}', {}, ('Foo','INVALID')),