« Voltar para Liferay Faces

Internationalizing JSF Portlets

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

0 Anexos
20359 Visualizações
Média (0 Votos)
A média da avaliação é 0.0 estrelas de 5.
Comentários
Comentar
Respostas do tópico Autor Data
Will this allow JSF to look into the liferay... lucas theisen 29 de Janeiro de 2013 11:13
It appears the Liferay language hook (solution... lucas theisen 31 de Janeiro de 2013 07:54
Apologies Lucas -- although I authored the... Neil Griffin 4 de Maio de 2013 13:16
Hi Neil, right now i am using a combination of... lucas theisen 6 de Maio de 2013 08:13
Have you considered adding your "portlet... Neil Griffin 6 de Maio de 2013 08:33
Yes, however we have many other projects that... lucas theisen 6 de Maio de 2013 08:45
I'm pretty sure that you can have more than one... Neil Griffin 6 de Maio de 2013 09:25
Hi everyone, I used the standard mechanism to... J Viso 28 de Janeiro de 2014 04:29
You mention i18n.properties so I am assuming... Neil Griffin 28 de Janeiro de 2014 06:54
Hi Neil, Yes, I was using option #1. And I... J Viso 30 de Janeiro de 2014 09:18
I'm glad to hear that it is working in your... Neil Griffin 30 de Janeiro de 2014 09:27
It would be nice to add how to find the... Natalio Sacerdote 7 de Novembro de 2014 01: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?
Postado em 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?
Postado em 31/01/13 07: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
Postado em 04/05/13 13:16 em resposta 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?
Postado em 06/05/13 08:13 em resposta 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
Postado em 06/05/13 08: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?
Postado em 06/05/13 08:45 em resposta 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.
Postado em 06/05/13 09: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.
Postado em 28/01/14 04: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.
Postado em 28/01/14 06:54 em resposta 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.
Postado em 30/01/14 09:18 em resposta 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. :-)
Postado em 30/01/14 09:27 em resposta 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".
Postado em 07/11/14 01:23.