Reputation: 1860
How can I add dynamic values in localized .properties
files?
I have a controller which uses GlobalMessages
from hybris to add a message from locales_**.properties
. The message should look like this:
**** [code] ****
Where code
is a dynamic value.
I've tried to do something like:
model.addAttribute("code",codeValue);
Then set the message key:
code.display = **** ${code} ****
But it didn't worked.
Upvotes: 1
Views: 829
Reputation: 1822
Do something like this in your jsp/tag file:
<spring:theme value="code.display" arguments="${code}" />
and change the message like this:
code.display = **** {0} ****
Also use one of the files in:
hybris/bin/custom/mystorefront/web/webroot/WEB-INF/messages/
Best idea is to use base.properties.
Upvotes: 2