Hi,
Hi,
Not sure if this is what you are asking for but in our project we have
rolled out some builder for StringResourceModel so that we can do things
like
new SRMB().with("name", "X").with("lastName". "Y").withObjects("0000",
"1111").build(key); ==> StringResourceModel()....;
A good idea but I was looking for something shorter than the
MessageFormat example I gave ;)
Cheers,
Tobi
if key is
key = {0} and {1} and ${name} and ${lastName}
result will be
0000 and 1111 and X and Y
it also supports setting a POJO.
On Wed, Apr 17, 2019 at 2:27 PM Tobias Gierke <[email protected]>
wrote:
Hi,
Is there any shorter way (shorter as in 'less characters to type') to do
this ?
feedback.info(MessageFormat.format(getString("feedback.info.reportDeleted"),
toDelete.getReportName()));
I know about StringResourceModel but
feedback.info(new
StringResourceModel("feedback.info.reportDeleted").setParameters(
toDelete.getReportName() ).getObject());
is not exactly shorter :/
It would be nice to have something like the following method on both
Component and Localizer:
/**
* Returns a localized string while applying <code>MessageFormat</code>
placeholder substitution.
*
* The placeholder syntax is the one supported by {@link
java.text.MessageFormat}.
*
* @param key Key of string resource in property file
* @param parameters Optional parameters for placeholder substitution
* @return The String
* @see java.text.MessageFormat
*/
public String getString(final String key,Object... parameters);
Cheers,
Tobias
P.S. We're on Wicket 8 btw
--
Tobias Gierke
Software Developer
Voipfuture GmbH Wendenstr. 4 20097 Hamburg Germany
Phone +49 40 688 9001 64 Fax +49 40 688 9001 99 www.voipfuture.com
Managing Directors Jan Bastian Eyal Ullert
Commercial Court AG Hamburg HRB 109896 VAT ID DE263738086