Search code examples
liferayliferay-hook

How to change liferay language properties file in hook


I've added a few items to the registration portal. Now I want to label them for the specific language. Liferay like.

in liferay hook :

<hook>
     <language-properties>content/Language_en.properties</language-properties>
     <language-properties>content/Language_fa.properties</language-properties>
</hook>

and in Language_en.properties :

 educationType= Education Type
 mobileNumber =Mobile Number

and in Language_fa.properties :

 educationType= persian education type 
 mobileNumber = persian  Mobile Number.

and craete_account.jsp

  <aui:input name="educationType" type="text"></aui:input>
  <aui:input label="Mobile Number" name="mobileNumber" type="tel"> </aui:input>

now, which way should i use to label these 2 items


Solution

  • First, import the ui taglib at the top of your page like this:

    <%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
    

    Then use the ui:message tag to render the appropriate label, passing in the correct key for that label, like this:

    <liferay-ui:message key="educationType" />