I frequently need to deal with singular and plural versions of
wicket:message's.
I would like to do something like:
add(new Label("links", new PluralStringResourceModel("link", this)
{
@Override
public boolean isPlural()
{
return /* some code like: */
model.getObject().getChildren().size() > 1;
}
}));
and this will use "link.plural" if isPlural() returns true and "link"
otherwise.
Has anybody found an elegant solution for such situations?
P.S. Here is a working implementation (neither efficient nor elegant)
for
the above approach:
add(new Label("link", new StringResourceModel("link${plural}",
this, new Model<Serializable>()
{
@Override
public Serializable getObject()
{
return new Serializable()
{
public String getPlural()
{
return model.getObject().getChildren().size() > 1 ?
".plural" : "";
}
};
}
})));
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]