Ticket #423: remove_isplural_from_i18nchoose.diff
| File remove_isplural_from_i18nchoose.diff, 2.1 KB (added by hodgestar, 12 years ago) |
|---|
-
genshi/filters/i18n.py
369 369 new_stream = [] 370 370 singular_stream = None 371 371 singular_msgbuf = None 372 plural_stream = None373 372 plural_msgbuf = None 374 373 375 374 numeral = self.numeral.evaluate(ctxt) 376 is_plural = self._is_plural(numeral, ngettext)377 375 378 376 for event in stream: 379 377 if event[0] is SUB and any(isinstance(d, ChooseBranchDirective) … … 387 385 new_stream.append((MSGBUF, None, (None, -1, -1))) 388 386 389 387 elif isinstance(subdirectives[0], PluralDirective): 390 if is_plural: 391 plural_stream = list(_apply_directives(substream, 392 subdirectives, 393 ctxt, vars)) 388 # plural stream is a convenience for generating a 389 # fallback for plurals when no translations exist, 390 # its XML structure is not expected to be preserved. 391 _plural_stream = list(_apply_directives(substream, 392 subdirectives, 393 ctxt, vars)) 394 394 395 395 else: 396 396 new_stream.append(event) … … 400 400 s, p, n) 401 401 402 402 singular_msgbuf = ctxt.get('_i18n.choose.singular') 403 if is_plural: 404 plural_msgbuf = ctxt.get('_i18n.choose.plural') 405 msgbuf, choice = plural_msgbuf, plural_stream 406 else: 407 msgbuf, choice = singular_msgbuf, singular_stream 408 plural_msgbuf = MessageBuffer(self) 403 plural_msgbuf = ctxt.get('_i18n.choose.plural') 409 404 405 msgbuf, choice = singular_msgbuf, singular_stream 406 410 407 for kind, data, pos in new_stream: 411 408 if kind is MSGBUF: 412 409 for event in choice:
