<metal:plural-msg define-macro="plural-message">
<tal:comment condition="nothing">
Expected variables to be defined in a containing tag or global:
count - value to check to determine plural form
singluar - string to use when count == 1
plural - string to use when count > 1. If no plural is given it defaults
to the singular value + 's'.
</tal:comment>
<tal:singular
condition="python: count == 1"
replace="singular" />
<tal:plural
define="l_default string:s; l_plural plural | string:$singular$l_default;"
condition="python: count != 1"
replace="l_plural" />
</metal:plural-msg>
And invoked it like:
<tal:message define="count view/product_suggestions_count; singular string:Is the following project the upstream for this source package?; plural string:Is one of these projects the upstream for this source package?"
>
<b> <metal:message use-macro="context/@@+base-layout-macros/plural-message"/>
</b> </tal:message>
That's all good but it is longer to use than the old way and required me to create a new property on the view class (product_suggestions_count). So, I'm left a little underwhelmed.
Curtis, based on your macro I created:
<metal:plural-msg define- macro=" plural- message" > "nothing" > "python: count == 1" "singular" /> "l_default string:s;
l_ plural plural | string: $singular$ l_default; " "python: count != 1" "l_plural" />
<tal:comment condition=
Expected variables to be defined in a containing tag or global:
count - value to check to determine plural form
singluar - string to use when count == 1
plural - string to use when count > 1. If no plural is given it defaults
to the singular value + 's'.
</tal:comment>
<tal:singular
condition=
replace=
<tal:plural
define=
condition=
replace=
</metal:plural-msg>
And invoked it like:
>
<b>
</b>
That's all good but it is longer to use than the old way and required me to create a new property on the view class (product_ suggestions_ count). So, I'm left a little underwhelmed.
What do you think?