i18n:choose displays both choices when i18n is not enabled
|Reported by:||Martin Scharrer <martin@…>||Owned by:||cmlenz|
|Keywords:||i18n:choose py:choose fallback||Cc:||hoff.st@…|
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.