Wicket has a flexible internationalisation system that also supports parameterising UI messages in many ways. There are examples e.g. in StringResourceModel javadocs, such as this:
WeatherStation ws = new WeatherStation();
add(new Label("weatherMessage", new StringResourceModel(
"weather.${currentStatus}", this, new Model<String>(ws)));
But I want something really simple, and couldn't find a good example of that.
Consider this kind of UI message in a .properties file:
cur=Current value is {0}
Specifically, I don't want to have to create a model object (with getters for the values to be replaced; like WeatherStation in the above example) just for this purpose. That's just overkill if I already have the value(s) in local variable(s), and there is otherwise no need for such object.
Here's a stupid "brute force" way to replace the {0} with the right value:
String value = ... // this contains the dynamic value to use
String text = getLocalizer().getString("cur", this).replaceAll("\\{0\\}", value);
add(new Label("message", text));
Is there a clean, more Wicket-y way to do this (that isn't awfully much longer than the above)?