Edgewall Software

Ticket #405 (new defect)

Opened 4 years ago

Last modified 4 years ago

i18n:choose displays both choices when i18n is not enabled

Reported by: Martin Scharrer <martin@…> Owned by: cmlenz
Priority: major Milestone: 0.7
Component: General Version: 0.6
Keywords: i18n:choose py:choose fallback Cc: hoff.st@…

Description

I'm trying to have a i18n aware Genshi template which supports both Trac 0.11 and 0.12. It has a i18n:choose directive in it to display different user messages depending if it is singular or plural. This works fine with Genshi 0.6 and Trac 0.12. When I use Trac 0.11, which as I know does not support i18n, with the same template and the same version of Genshi, both choices are displayed, i.e. the i18n:choose and i18n:singular/i18n:plural tags seem to simple be ignored.

This should not be the case. While there will be of course no translation, the original English text should still be displayed in the correct form. The numeral argument can still be evaluated and the whole thing could simply fall-back to a py:choose directive.

As a workaround I set a i18n_enabled variable and added the arguments py:if="i18n_enabled or len(elem) == 1" and py:if="i18n_enabled or len(elem) > 1" to the i18n:singular and i18n:plural tags, respectively. This seems to be working ok with i18n enabled under Trac 0.12.

Attachments

Change History

in reply to: ↑ description   Changed 4 years ago by Martin Scharrer <martin@…>

Replying to Martin Scharrer <martin@…>:

As a workaround I set a i18n_enabled variable and added the arguments py:if="i18n_enabled or len(elem) == 1" and py:if="i18n_enabled or len(elem) > 1" to the i18n:singular and i18n:plural tags, respectively. This seems to be working ok with i18n enabled under Trac 0.12.

While this workaround works with Genshi it doesn't with Babels extract_messages setup command. :-(

Add/Change #405 (i18n:choose displays both choices when i18n is not enabled)

Author


E-mail address and user name can be saved in the Preferences.


Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from cmlenz. Next status will be 'new'
The owner will change from cmlenz to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.