Tuesday, April 21, 2015

Language Properties Hook in Liferay

Today we will discuss about Language Properties hook.Language property hook are used to overriding the existed portal language properties like Language_en.properties file for overriding of english language file.We can also add new properties by using Language Property hook.

Today we change :-
1) Button text Sign In  to Login .
2)Error message This Field is required to Please enter this field.

So Lets start this step by step:-

Step 1:-Create Liferay hook project
File-->New-->Liferay Plugin Project-->Provide name-->Select hook in plugin type-->Finish.
You can see snapshot in my previous article (Step 1)   Portal Properties Hook in Liferay.

Step 2:-Create  hook inside project
Right click on project-->New-->Liferay hook Configuration-->tick Language.properties-->Next

then click on Add and provide name of property file which you want to override in my case i provide Language_en.properties

then click Ok and Finish.

Step 3:-Override Properties
Open Language_en.properties file which is inside content folder.Now if you attached source code in your eclipse press (ctrl+shift+r) and search for Language_en.properties

and open it .Now copy all the content of Language_en.properties of liferay file to our Language_en.properties file.

Now search for Key:-
1)this-field-is-required and change the value to Please enter this field.Ex- this-field-is-required=Please enter this field.
2)sign-in and change to Login.Ex-  sign-in=Login

Step 4:-Entry in liferay-hook.xml
This entry is automatically created by eclipse as:-

Step 5:-Check output
Deploy your hook and put out of box language portlet on your page and select english ie American Flag

And thats it refresh your page to see the output as:-

Here you can see Sign In change to Login and This field is required change to Please enter this field.

Project Structure

You can Download Source code from Language Property Hook in Liferay

Hope this will Help....

Related Post:-

No comments:

Post a Comment

Total Pageviews

Number Of Unique Visitor

Free counters!