« Volver a Liferay Faces

Internationalizing JSF Portlets

This article has been incorporated into the official Liferay documentation. Refer to the section titled Localizing JSF Portlets.

0 archivos adjuntos
33547 Accesos
Promedio (0 Votos)
La valoración media es de 0.0 estrellas de 5.
Comentarios
Respuestas anidadas Autor Fecha
Will this allow JSF to look into the liferay... lucas theisen 29 de enero de 2013 11:13
It appears the Liferay language hook (solution... lucas theisen 31 de enero de 2013 7:54
Apologies Lucas -- although I authored the... Neil Griffin 4 de mayo de 2013 13:16
Hi Neil, right now i am using a combination of... lucas theisen 6 de mayo de 2013 8:13
Have you considered adding your "portlet... Neil Griffin 6 de mayo de 2013 8:33
Yes, however we have many other projects that... lucas theisen 6 de mayo de 2013 8:45
I'm pretty sure that you can have more than one... Neil Griffin 6 de mayo de 2013 9:25
Hi everyone, I used the standard mechanism to... J Viso 28 de enero de 2014 4:29
You mention i18n.properties so I am assuming... Neil Griffin 28 de enero de 2014 6:54
Hi Neil, Yes, I was using option #1. And I... J Viso 30 de enero de 2014 9:18
I'm glad to hear that it is working in your... Neil Griffin 30 de enero de 2014 9:27
It would be nice to add how to find the... Natalio Sacerdote 7 de noviembre de 2014 1:23

Will this allow JSF to look into the liferay Language_en_US.properties file for its validator messages? More to the point, if i add my message overrides in my company wide Language_en_us.properties, will the JSF framework find them there?
Publicado el día 29/01/13 11:13.
It appears the Liferay language hook (solution 2 above) only works from a single portlet. If I have multiple portlets that each have their own Language.properties file what should I do? I am thinking the best way to handle is either use liferayfaces i18n for Liferay built-in messages and solution 1 above with portletI18n for the resource bundle var to get portlet specific messages. Is there a better way? Is it possible to configure the liferayfaces i18n to pull messages from a portlet specific resource bundle first then the Liferay built-in if the message was not found?
Publicado el día 31/01/13 7:54.
Apologies Lucas -- although I authored the article, somehow I wasn't subscribed to this Wiki and didn't get alerted. Do you still need answers to these questions? -- Neil
Publicado el día 4/05/13 13:16 en respuesta a lucas theisen.
Hi Neil, right now i am using a combination of the 2approaches in the same project. I use i18n for liferay messages and pi18n (approach 1 above) to get portlet specific messages. This has a downside that it causes failures if the message doesnt exist (which liferay i18n seems to get around by returning the key itself if no message was found). It would be nice if the liferay i18n object could be configured with a portlet resource that it checks first and if the requested message is not found it passes it along to the liferay i18n. Best of both worlds approach. But I guess that makes this more of a feature request... What do you think? Is there a better way?
Publicado el día 6/05/13 8:13 en respuesta a Neil Griffin.
Have you considered adding your "portlet specific messages" via approach #2 using the hook? That's what we do in the jsf2-registration-portlet:
https://github.com/liferay/liferay-faces/blob/3.1.x/de­mos/portal/jsf2-registration-portlet/src/main/resources/Language_en_US.propertie­s
Publicado el día 6/05/13 8:33.
Yes, however we have many other projects that all have their own messages. I was under the understanding that there can be only one language hook per liferay instance. Is that incorrect?
Publicado el día 6/05/13 8:45 en respuesta a Neil Griffin.
I'm pretty sure that you can have more than one Language hook per portal instance. I recommend giving it a try.
Publicado el día 6/05/13 9:25.
Hi everyone,

I used the standard mechanism to internationalize my jsf portlet. It's working on Windows (Win7) but not in Linux (Fedora19).

Using exactly the same JBoss EAP 6.1 on Win7, when I change the language using the flags selector portlet, the text on the portlet change according the current culture, but not when JBoss is running on Fedora19.

On Fedora19, Liferay only translates the strings translated by the Liferay core, but doesn't translate the string I've localized on my i18n .properties files.

Do I have to do some extra work on Linux/Fedora?
What can I do to check if something is wrong?

Please tell me if you need any information or file to see what's the problem.

I appreciate your help, thanks in advance.
Publicado el día 28/01/14 4:29.
You mention i18n.properties so I am assuming that you are using option#1 from the wiki article. Please try option#2 with the liferay-hook.xml and see if it works better.
Publicado el día 28/01/14 6:54 en respuesta a J Viso.
Hi Neil,

Yes, I was using option #1. And I tested it with the jsf2-portlet demo, and the result is the same: working on Windows7, not working on Fedora19.

As you suggested, I tried the option #2. And it works, with my project and with the jsf2-registration-portlet demo. And in both systems Win&Linux.

So, maybe there's a problem with the option #1 in some enviroments...

Let me point up also something about .properties language files. With the option #1 these files must have the ISO-8859-1 enconding, and the non ASCII characters escaped to unicode, to see them correctly on Liferay. But using the option #2, these files have to be UTF-8 encoded.

Anyway, the problem is solved, so thanks a lot.
Publicado el día 30/01/14 9:18 en respuesta a Neil Griffin.
I'm glad to hear that it is working in your environment now. And thanks for the helpful information about ISO-8859-1 encoding with option #1. :-)
Publicado el día 30/01/14 9:27 en respuesta a J Viso.
Natalio Sacerdote
It would be nice to add how to find the "thousands of existing internationalized keys that ship with Liferay Portal".
I was able to find them by extracting the contents of:
"tomcat-directory\webapps\ROOT\WEB-INF\lib\portal-impl.jar"
Then looking for file with name "Language_en.properties".
Publicado el día 7/11/14 1:23.