How to change liferay language properties file in hook

1.3k Views Asked by At

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

2

There are 2 best solutions below

0
On BEST ANSWER

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" />
0
On

Follow this link to create Language.properties hook:

http://proliferay.com/liferay-language-properties-hook-development/