1
votes

In Liferay, I want to do a portlet displaying a greeting with the user name. This message could be in different language.

how can I put a parameter from jsp expression language to language property String?

I tried to write something like this in language.properties

portlet.body.line1=Hello ${name},

and use it in my view.jsp

<liferay-ui:message key="portlet.body.line1" />

But it doesn't work.

How can I do this?

1

1 Answers

0
votes

You can't use expression language in this way. You'll have to know what the translated text contains and use Language.properties like this:

portlet.body.line1=Hello {0}

in a jsp like this

<liferay-ui:message key="portlet.body.line1" arguments="Pierre" />

Actually, you might be able to use EL here and use arguments="${name}" - try it. the arguments attribute can also take a String array in case you have more parameters (like "{0}, {1}")