Ticket #14126: blocktrans.diff

File blocktrans.diff, 1.7 KB (added by Alexander Artemenko, 14 years ago)
  • django/templatetags/i18n.py

     
    7878            context[self.countervar] = count
    7979            plural, plural_vars = self.render_token_list(self.plural)
    8080            result = translation.ungettext(singular, plural, count)
    81             if count != 1:
    82                 vars = plural_vars
     81            vars.extend(plural_vars)
    8382        else:
    8483            result = translation.ugettext(singular)
    8584        # Escape all isolated '%' before substituting in the context.
  • tests/regressiontests/templates/tests.py

     
    11191119            # translation of plural form with extra field in singular form (#13568)
    11201120            '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"),
    11211121
     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
    11221125            ### HANDLING OF TEMPLATE_STRING_IF_INVALID ###################################
    11231126
    11241127            'invalidstr01': ('{{ var|default:"Foo" }}', {}, ('Foo','INVALID')),
Back to Top