留言板

How to change "Language.properties" of a portlet

Luca kk,修改在11 年前。

How to change "Language.properties" of a portlet

Expert 帖子: 284 加入日期: 10-12-7 最近的帖子
Hi all,
I try to change the "Language.properties" file in "WEB-INF/src/content"
of a portlet but I can't see the update when i restart tomcat (deleting work and temp directory).

Anybody knows why?
How can I do?

Thanks in advance.
thumbnail
Apoorva Prakash,修改在11 年前。

RE: How to change "Language.properties" of a portlet

Liferay Master 帖子: 658 加入日期: 10-6-15 最近的帖子
Hey Luca,

You need to create a hook for this purpose.

This link may help you in regard.

Hope this will help,

Thanks and Regards,
Apoorva Prakash
thumbnail
Tejas Kanani,修改在11 年前。

RE: How to change "Language.properties" of a portlet

Liferay Master 帖子: 654 加入日期: 09-1-6 最近的帖子
Have you specified any particular locale (<supported-locale>) in portlet.xml ?
Luca kk,修改在11 年前。

RE: How to change "Language.properties" of a portlet

Expert 帖子: 284 加入日期: 10-12-7 最近的帖子
I explain better.
In accessibility portlet, with default language EN, i have "Language.properties" file:

##
##	Portlet Infos
##
javax.portlet.title=Accessibility
javax.portlet.short-title=Accessibility
javax.portlet.keywords=This portlet provides theme display personalization for unauthenticated users.

##
##	Portlet Accessibility
##

accessibility.portlet-title=Accessibility settings

accessibility.back-to-normal=Back to normal
accessibility.background-color=Background color
accessibility.choose-a-color=Choose a color :
accessibility.field.navigation-under-content=Set navigation under content
accessibility.font-color=Font color
accessibility.font-size=Font size
accessibility.more-colors=More colors...
accessibility.preview=Preview
accessibility.selectable-color-is-x=This color is rgb-coded as: {0}

help.please-enter-comma-separated-portletids=Please enter a comma-separated list of portlet ids
help.please-enter-comma-separated-templateids=Please enter a comma-separated list of web content template ids
help.please-enter-comma-separated-webcontentids=Please enter a comma-separated list of web content ids

portlets-to-filter=Portlets to filter
web-content-templates-to-filter=Web content templates to filter
web-contents-to-filter=Web contents to filter


and Language_en_US.properties file:

##
##	Portlet Infos
##
javax.portlet.title=Accessibility
javax.portlet.short-title=Accessibility
javax.portlet.keywords=This portlet provides theme display personalization for unauthenticated users.

##
##	Portlet Accessibility
##

accessibility.portlet-title=Accessibility settings

accessibility.back-to-normal=Back to normal
accessibility.background-color=Background color
accessibility.choose-a-color=Choose a color :
accessibility.field.navigation-under-content=Set navigation under content
accessibility.font-color=Font color
accessibility.font-size=Font size
accessibility.more-colors=More colors...
accessibility.preview=Preview
accessibility.selectable-color-is-x=This color is rgb-coded as: {0}

help.please-enter-comma-separated-portletids=Please enter a comma-separated list of portlet ids
help.please-enter-comma-separated-templateids=Please enter a comma-separated list of web content template ids
help.please-enter-comma-separated-webcontentids=Please enter a comma-separated list of web content ids

portlets-to-filter=Portlets to filter
web-content-templates-to-filter=Web content templates to filter
web-contents-to-filter=Web contents to filter


I want to change the strings fron english to italian, for example:

accessibility.portlet-title=[b]Impostazione di accessibilità[/b]
accessibility.background-color=[b]Colore di sfondo[/b]
.....etc


How have I do?
Luca kk,修改在11 年前。

RE: How to change "Language.properties" of a portlet

Expert 帖子: 284 加入日期: 10-12-7 最近的帖子
Hi Apporva,
thanks for reply.
I never did a hook before but can I do a hook to only change
a properties file?

if yes, how?

Luca
thumbnail
Apoorva Prakash,修改在11 年前。

RE: How to change "Language.properties" of a portlet

Liferay Master 帖子: 658 加入日期: 10-6-15 最近的帖子
Yea Luca, you can... Use the link that I've provided you in my previous post... Its very clear.

Thanks,
Apoorva Prakash
Luca kk,修改在11 年前。

RE: How to change "Language.properties" of a portlet

Expert 帖子: 284 加入日期: 10-12-7 最近的帖子
Hi Apporva,
I read your link but it isn't so clear.
Do I have to create an XML file?
And then, where do I have to put this file?
I develop with netbeans.

Thanks
thumbnail
Apoorva Prakash,修改在11 年前。

RE: How to change "Language.properties" of a portlet

Liferay Master 帖子: 658 加入日期: 10-6-15 最近的帖子
Luca,

First of all, you have to create a new hook, and then you'll get XML file inside it. Make the necessary entry in it, and place the properties file in correct location.

Further, deploy it, and now you are done. Use the property. That's all.

Thanks and Regards,
Apoorva Prakash
Luca kk,修改在11 年前。

RE: How to change "Language.properties" of a portlet

Expert 帖子: 284 加入日期: 10-12-7 最近的帖子
Ok Apoorva,
now it's more clear.
But, how do I link the hook with accessibility portlet above said?
Luca kk,修改在11 年前。

RE: How to change "Language.properties" of a portlet

Expert 帖子: 284 加入日期: 10-12-7 最近的帖子
In the "WEB-INF" directory of accessibility portlet there is a
"liferay-hook.xml" contains:

<!--?xml version="1.0" encoding="UTF-8"?-->


-<hook> <portal-properties>portal.properties</portal-properties> </hook>


Do I have to create a <language-properties> element in this file?
thumbnail
Tejas Kanani,修改在11 年前。

RE: How to change "Language.properties" of a portlet

Liferay Master 帖子: 654 加入日期: 09-1-6 最近的帖子
For overriding language properties file using hook you'll have to add below lines in xml file with the Language file needs to overridden.
i.e.
<language-properties>content/Language_es.properties</language-properties>


For more details,
http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/overriding-a-%3Cem%3Elanguage-properties%3C-em%3E-fi-1

Regards,
Tejas
thumbnail
Hitoshi Ozawa,修改在11 年前。

RE: How to change "Language.properties" of a portlet

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
Before going any further, are you trying to change messages in YOUR portlet or messages in liferay?
If it's your portlet, you don't need to create a hook.
richard naoufal,修改在10 年前。

RE: How to change "Language.properties" of a portlet

Junior Member 帖子: 34 加入日期: 13-4-4 最近的帖子
Hello,

How to change the language in one portlet ?

Thank you !
thumbnail
Maheswar Sahu,修改在8 年前。

RE: How to change "Language.properties" of a portlet

New Member 帖子: 6 加入日期: 13-4-29 最近的帖子
Hi,

Can you please suggest how to create language property file for module wise,
suppose there are 3 modules in the project than property file may like

Language_en_module1.properties
Language_en_module2.properties
Language_en_module3.properties

Language_es_module1.properties
Language_es_module2.properties
Language_es_module3.properties

So i can pass the local variable with module name and the property key to get value.