Fórum
Translate portlet name
nathan chantrenne, modificado 13 Anos atrás.
Translate portlet name
New Member Postagens: 3 Data de Entrada: 21/07/10 Postagens Recentes
Hi everyone,
i am using Liferay portal 5.1 in French and English. My problem is that when using the link "Add Application" i don't know how to show portlet names in any language. In my custom portlets, name is defined in the file portlet.xml like this :
So, how can i do to have a title that change depending on user locale ?
Thanks in advance.
i am using Liferay portal 5.1 in French and English. My problem is that when using the link "Add Application" i don't know how to show portlet names in any language. In my custom portlets, name is defined in the file portlet.xml like this :
<portlet-info>
<title>Title</title>
<short-title>title</short-title>
<keywords>title</keywords>
</portlet-info>
So, how can i do to have a title that change depending on user locale ?
Thanks in advance.
Alexandre FIEVEE, modificado 13 Anos atrás.
RE: Translate portlet name
New Member Postagens: 23 Data de Entrada: 24/10/08 Postagens Recentes
Hi,
You've to add translation into the language-ext_fr.properties file, located in "ext-impl/src/content".
Portlet translation title si like this :
javax.portlet.title.myportlet=My portlet
"myportlet" si the name setted in your liferay-portlet-ext.xml.
You've to add translation into the language-ext_fr.properties file, located in "ext-impl/src/content".
Portlet translation title si like this :
javax.portlet.title.myportlet=My portlet
"myportlet" si the name setted in your liferay-portlet-ext.xml.
nathan chantrenne, modificado 13 Anos atrás.
RE: Translate portlet name
New Member Postagens: 3 Data de Entrada: 21/07/10 Postagens Recentes
My portlets are developped outside Liferay and added to Tomcat as war files, so I don't have any ext-impl folder nor liferay-portlet-ext.xml but for all my portlet I have a file portlet.xml, a file liferay-portlet.xml...
Corné A, modificado 13 Anos atrás.
RE: Translate portlet name
Liferay Legend Postagens: 1313 Data de Entrada: 03/10/06 Postagens Recentes
add this to your own portlets property files
and define it in portlet.xml
javax.portlet.short-title=Foor short
javax.portlet.title=Foo title
javax.portlet.keywords=Foo FOO fooeid
and define it in portlet.xml
<portlet>
<resource-bundle>com.foo.Resource</resource-bundle></portlet>
nathan chantrenne, modificado 13 Anos atrás.
RE: Translate portlet name
New Member Postagens: 3 Data de Entrada: 21/07/10 Postagens Recentes
That's what I was looking for, translation is OK now.
Thank you.
Thank you.
Andew Jardine, modificado 12 Anos atrás.
RE: Translate portlet name
Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes
Hi,
I have a similar situation, however, I have multiple portlets defined within the same portlet.xml. I am trying to distinguish them using the following key structure --
javax.portlet.title.portlet-name
so that if I have
Then in my resource bundle I am trying to use --
javax.portlet.title.search=Search Portlet
.. but it doesn't seem to be working. I am on Lifreay 6, any tips?
aj.
PS> I should add that I am trying to does this in multiple languages for I have Resources_en, Resources_fr, Resources_es, etc.
I have a similar situation, however, I have multiple portlets defined within the same portlet.xml. I am trying to distinguish them using the following key structure --
javax.portlet.title.portlet-name
so that if I have
<portlet>
<portlet-name>search</portlet-name>
<display-name>Search Portlet</display-name>
...
</portlet>
Then in my resource bundle I am trying to use --
javax.portlet.title.search=Search Portlet
.. but it doesn't seem to be working. I am on Lifreay 6, any tips?
aj.
PS> I should add that I am trying to does this in multiple languages for I have Resources_en, Resources_fr, Resources_es, etc.
Corné Aussems, modificado 12 Anos atrás.
RE: Translate portlet name
Liferay Legend Postagens: 1313 Data de Entrada: 03/10/06 Postagens Recentes
Ravi Kumar Gupta, modificado 12 Anos atrás.
RE: Translate portlet name
Liferay Legend Postagens: 1302 Data de Entrada: 24/06/09 Postagens Recentes
Hi Corné,
This is not for all standard portlet or is it? Will this work for Liferay only..??
-Ravi
This is not for all standard portlet or is it? Will this work for Liferay only..??
javax.portlet.title.portlet123=My Portlet
-Ravi
Corné Aussems, modificado 12 Anos atrás.
RE: Translate portlet name
Liferay Legend Postagens: 1313 Data de Entrada: 03/10/06 Postagens Recentes
Hi Ravi,
AFAIK this is specific to Liferay and not in the JSR 168/286
See for more info:
http://www.liferay.com/community/wiki/-/wiki/Main/Portlet+Localization+-+Outside+Liferay#section-Portlet+Localization+-+Outside+Liferay-Portlet+Title
AFAIK this is specific to Liferay and not in the JSR 168/286
See for more info:
http://www.liferay.com/community/wiki/-/wiki/Main/Portlet+Localization+-+Outside+Liferay#section-Portlet+Localization+-+Outside+Liferay-Portlet+Title
Ravi Kumar Gupta:
Hi Corné,
This is not for all standard portlet or is it? Will this work for Liferay only..??javax.portlet.title.portlet123=My Portlet
-Ravi
Ravi Kumar Gupta, modificado 12 Anos atrás.
RE: Translate portlet name
Liferay Legend Postagens: 1302 Data de Entrada: 24/06/09 Postagens Recentes
Thanks Corné.. that was helpful.
Andew Jardine, modificado 12 Anos atrás.
RE: Translate portlet name
Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes
Hi Corné,
Maybe if I provide a better example . In my portlet.xml I have this --
I tried putting javax.portlet.title.endeca-navigation=... in both my Resources_en/fr and in a Languages_en/fr but in both cases the same title is showing. I followed the link that you posted on this thread and found this at the bottom --
but I thought it was said here that Liferay supported the technique. If that is the case, am I specifying the values in the wrong place? Or am I missing something? This looks fairly straight forward to me, but it's not picking up.
Maybe if I provide a better example . In my portlet.xml I have this --
<portlet>
<portlet-name>endeca-navigation</portlet-name>
<display-name>Endeca Navigation Portlet</display-name>
...
</portlet>o
I tried putting javax.portlet.title.endeca-navigation=... in both my Resources_en/fr and in a Languages_en/fr but in both cases the same title is showing. I followed the link that you posted on this thread and found this at the bottom --
Remember, if you have more than one portlet in your war, they won't be able to share the same resource bundle. What does this mean? It means you can't do this (as is done in the portal war):
javax.portlet.title.xxxx=TEST
You can only do:
javax.portlet.title=TEST
Use the method suggested above to separate your portlet resource bundles.
but I thought it was said here that Liferay supported the technique. If that is the case, am I specifying the values in the wrong place? Or am I missing something? This looks fairly straight forward to me, but it's not picking up.
Corné Aussems, modificado 12 Anos atrás.
RE: Translate portlet name
Liferay Legend Postagens: 1313 Data de Entrada: 03/10/06 Postagens Recentes
You should then define a different <resource-bundle>com.my.portlets.p1.Resource</resource-bundle> per Portlet
and use the normal JCR key javax.portlet.title.
and use the normal JCR key javax.portlet.title.
Josef Šustáček, modificado 12 Anos atrás.
RE: Translate portlet name
New Member Postagens: 22 Data de Entrada: 05/10/09 Postagens Recentes
Hi,
if you need to localize several portlets' names, simply create separate .properties file for each of it, every with its own javax.portlet.title=XXX. The file can be emptry except this one line. Then the rest of localizaed messages could be shared, in some e.g. common.properties file.
In JSPs, you cant then load you localized messages from any file you want, just set it up to do so (using FMT, Spring taglib etc.). Using Spring, you even can define a MessageSource being composed from as many .properties files you want.
As someone already wrote before, you cannot localize names of more portlets in one .properties file via javax.portlet.title.<portlet_name>=XXX convention.
if you need to localize several portlets' names, simply create separate .properties file for each of it, every with its own javax.portlet.title=XXX. The file can be emptry except this one line. Then the rest of localizaed messages could be shared, in some e.g. common.properties file.
In JSPs, you cant then load you localized messages from any file you want, just set it up to do so (using FMT, Spring taglib etc.). Using Spring, you even can define a MessageSource being composed from as many .properties files you want.
As someone already wrote before, you cannot localize names of more portlets in one .properties file via javax.portlet.title.<portlet_name>=XXX convention.
Andew Jardine, modificado 12 Anos atrás.
RE: Translate portlet name
Liferay Legend Postagens: 2416 Data de Entrada: 22/12/10 Postagens Recentes
Hi Josef,
I think I need to do exactly what you are suggesting, but I have never done this before. Can you point me to someplace where I can understand how to do this?
I think I need to do exactly what you are suggesting, but I have never done this before. Can you point me to someplace where I can understand how to do this?
Josef Šustáček, modificado 12 Anos atrás.
RE: Translate portlet name
New Member Postagens: 22 Data de Entrada: 05/10/09 Postagens Recentes
Hi,
I'm not sure, what exactly you need to understand.
As I wrote before, create more .properties files, for every portlet one, and for every portlet, reference its file in portlet.xml in portlet's <resource-bundle />.
I assume, you ale localizing you messages (like button labels, fields labels, static texts in portlets) in your JSP files. You can load localized messages via two concepts (surely more, but these two are most commonly used):
Hope its enough for you to start.
I'm not sure, what exactly you need to understand.
As I wrote before, create more .properties files, for every portlet one, and for every portlet, reference its file in portlet.xml in portlet's <resource-bundle />.
I assume, you ale localizing you messages (like button labels, fields labels, static texts in portlets) in your JSP files. You can load localized messages via two concepts (surely more, but these two are most commonly used):
- FMT taglib from JSTL: http://codesnippets.joyent.com/posts/show/1151 -- beware and test the localization properly, when I used this approach the last time (LFR 5.2.3), currently selected portal language was not loaded correctly from portletRequest (i got messages localized in default locale, not the current one)
- Spring MVC taglib from Spring framework: http://viralpatel.net/blogs/2010/07/spring-3-mvc-internationalization-i18n-localization-tutorial-example.html -- works simply and superb and lets you define more files, from which you can load localized message via one line of JSP code.
- You only need to define you messageSource bean in context XML of your portlet, then it will automatically be loaded in you portlet JSPs. No need to define locale resolvers, it is all leveraged to portlal via Spring's implementaion of portlet MVC.
Hope its enough for you to start.
Jonas Fonseca, modificado 12 Anos atrás.
RE: Translate portlet name
New Member Postagens: 11 Data de Entrada: 20/10/10 Postagens RecentesAndew Jardine:
but I thought it was said here that Liferay supported the technique. If that is the case, am I specifying the values in the wrong place? Or am I missing something? This looks fairly straight forward to me, but it's not picking up.
It is only supported for internal Liferay portlets. For portlets added via a plugin, you have to either specify the translated titles in portlet.xml or use separate resource bundles.
To make it easier to manage the resource bundle files in plugins with multiple portlets, I usually use ant to create the portlet-specific resource bundle files from a single resource bundle. I've described the technique here:
http://blog.priorarts.org/2011/11/getting-javaxportlettitleportletname-to.html