Fórum
How to change Liferay's culture in code
Lior Hadaya, modificado 11 Anos atrás.
How to change Liferay's culture in code
Regular Member Postagens: 138 Data de Entrada: 24/01/12 Postagens Recentes
Hello,
I'm using Liferay EE 6.1.20 and I need to support a flow of changing the culture/language by the user.
How can I switch Liferay's culture in code?
I found the LocaleUtil class but I'm not sure if it would help, hard to understand what each method there actually does.
Please advise,
Thanks
I'm using Liferay EE 6.1.20 and I need to support a flow of changing the culture/language by the user.
How can I switch Liferay's culture in code?
I found the LocaleUtil class but I'm not sure if it would help, hard to understand what each method there actually does.
Please advise,
Thanks
Lior Hadaya, modificado 11 Anos atrás.
RE: How to change Liferay's culture in code
Regular Member Postagens: 138 Data de Entrada: 24/01/12 Postagens Recentes
I figured out how to do it.
and then $language_url contains a URL that redirecting to it changes the portal's locale to French.
#set ($language_url = $portletURLFactory.create($request, "82", $themeDisplay.getPlid(), "ACTION_PHASE"))
$language_url.setWindowState("normal")
$language_url.setPortletMode("view")
$language_url.setParameter("struts_action", "/language/view")
$language_url.setParameter("languageId", "fr_FR")
and then $language_url contains a URL that redirecting to it changes the portal's locale to French.
Hitoshi Ozawa, modificado 11 Anos atrás.
RE: How to change Liferay's culture in code
Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
You meant "country" instead of "culture". I think your question stunned a lot of people because of it.
Nice to see that you've figured it out yourself.
Nice to see that you've figured it out yourself.
James Falkner, modificado 11 Anos atrás.
RE: How to change Liferay's culture in code
Liferay Legend Postagens: 1399 Data de Entrada: 17/09/10 Postagens RecentesHitoshi Ozawa:
You meant "country" instead of "culture". I think your question stunned a lot of people because of it.
Jack Bakker, modificado 11 Anos atrás.
RE: How to change Liferay's culture in code
Liferay Master Postagens: 978 Data de Entrada: 03/01/10 Postagens Recentes
unique keyword culture is
(yoda grammer)
(yoda grammer)
Lior Hadaya, modificado 11 Anos atrás.
RE: How to change Liferay's culture in code
Regular Member Postagens: 138 Data de Entrada: 24/01/12 Postagens Recentes
Hitoshi Ozawa, modificado 11 Anos atrás.
RE: How to change Liferay's culture in code
Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
Looking at the MS docs, it seems "culture code" is used to determine more than just the language used.
In Java, Locale is "language" and "country".
http://docs.oracle.com/javase/7/docs/api/java/util/Locale.html
Another user was posting about changing calendar (e.g. Hijri). I've also asked liferay.com to change "conventions associated with a particular culture". It's currently not supported by liferay so I had to make my own additions.
That said, Liferay doesn't support "culture codes".
The CultureInfo class provides culture-specific information, such as the language, sublanguage, country/region, calendar, and conventions associated with a particular culture.
In Java, Locale is "language" and "country".
http://docs.oracle.com/javase/7/docs/api/java/util/Locale.html
Another user was posting about changing calendar (e.g. Hijri). I've also asked liferay.com to change "conventions associated with a particular culture". It's currently not supported by liferay so I had to make my own additions.
That said, Liferay doesn't support "culture codes".