Code review comment for lp:~bac/launchpad/bug-490518-link-suggestion

Revision history for this message
Brad Crittenden (bac) wrote :

Curtis, based on your macro I created:

<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.

What do you think?

« Back to merge proposal