Foros de discusión

Liferay 6.2 - guest not able to change language

Helder Silva, modificado hace 10 años.

Liferay 6.2 - guest not able to change language

New Member Mensajes: 2 Fecha de incorporación: 20/12/13 Mensajes recientes
Using Liferay Portal 6.2.
I am not able to make the language combo work for guest user.
It works well for authenticated users, but guest users are not able to select the site language. I have already check the permissions under the role for guest user, and it is set to work.
Unfortunately guest users can change the language combo but nothing happens. Can anyone help on this?
Bunel Moise, modificado hace 10 años.

RE: Liferay 6.2 - guest not able to change language

New Member Mensaje: 1 Fecha de incorporación: 18/08/12 Mensajes recientes
I can add that I face a similar issue on liferay 6.2.0.
Here is the description:
I have a site with 2 languages,English and Romanian. Romanian is the default language.
I can navigate on EN and RO on each page if I login but I cannot do that as a guest.
Anyway I am able to navigate "by hand" as a guest, using the prefix "en" to the url and go to the non-default English content...
The interesting thing is that I can come back to the default "RO" page using the language portlet.

In fact it seems the guest cannot change from default to non-default language, but can change back to default language using the "language portlet".

Notes:
I changed the rights of the guest user so he can view the language-portlet.
I have the line: "locale.prepend.friendly.url.style=1" in portal-ext.properties and that means "en" should be used as a prefix in the url.
I paste here an example of a link provided by the language portlet on my "about" page and we can see that the "redirect" argument does not contain the prefix "en"...

http://localhost/web/eurosoftware-srl/about?p_p_id=82&p_p_lifecycle=1&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_pos=1&p_p_col_count=2&_82_struts_action=%2Flanguage%2Fview&_82_redirect=%2Fweb%2Feurosoftware-srl%2Fabout&_82_languageId=en_US
thumbnail
Juan Gonzalez, modificado hace 10 años.

RE: Liferay 6.2 - guest not able to change language

Liferay Legend Mensajes: 3089 Fecha de incorporación: 28/10/08 Mensajes recientes
Hi Helder,

it's a known bug:

https://issues.liferay.com/browse/LPS-42075
asif aftab, modificado hace 10 años.

RE: Liferay 6.2 - guest not able to change language

Regular Member Mensajes: 123 Fecha de incorporación: 2/09/13 Mensajes recientes
Hi
Then what is the remedy of this. If any one solve this problem then please share with community or any suggestion to solve this issue or is there any other scope to achieve this please advice me.
Thanks
asif aftab
thumbnail
Juan Gonzalez, modificado hace 10 años.

RE: Liferay 6.2 - guest not able to change language

Liferay Legend Mensajes: 3089 Fecha de incorporación: 28/10/08 Mensajes recientes
You can patch source code yourself looking for changes in github, or ask for Liferay support.
asif aftab, modificado hace 10 años.

RE: Liferay 6.2 - guest not able to change language

Regular Member Mensajes: 123 Fecha de incorporación: 2/09/13 Mensajes recientes
Changing means the additional code added to the link that you given we have to add that one in my portlet code. Means I have to use ext. Frankly speaking I am not so much senior I didn't work on hook and ext. So please help me ho to do patch and any other things. We are using community edition so I don't think so any help from liferay site or they may help to the user of community edition too.
Thanks for your reply and please provide information that you have
Thanks
asif aftab
thumbnail
Gabriel Bustos Padilla, modificado hace 10 años.

RE: Liferay 6.2 - guest not able to change language

Junior Member Mensajes: 63 Fecha de incorporación: 6/03/13 Mensajes recientes
Have anybody the solution to this problem? I have a virtual machine with a comunity version of LR and I doesn´t have any patch. Have LF support solved this problem throught any patch?

thanks in advance
thumbnail
Jeffrey Handa, modificado hace 10 años.

RE: Liferay 6.2 - guest not able to change language

Liferay Master Mensajes: 541 Fecha de incorporación: 1/12/08 Mensajes recientes
Hi Gabriel,
This issue is in the list of issues resolved in 6.2 CE GA2. You can check out James Falkner's blog post for additional details about this release.
thumbnail
Gabriel Bustos Padilla, modificado hace 10 años.

RE: Liferay 6.2 - guest not able to change language

Junior Member Mensajes: 63 Fecha de incorporación: 6/03/13 Mensajes recientes
Thanks!! I will download it.

best regards
Helder Silva, modificado hace 10 años.

RE: Liferay 6.2 - guest not able to change language

New Member Mensajes: 2 Fecha de incorporación: 20/12/13 Mensajes recientes
Thank you Jeffrey.
Helder
Francesc Domenech, modificado hace 10 años.

RE: Liferay 6.2 - guest not able to change language

New Member Mensajes: 4 Fecha de incorporación: 12/03/12 Mensajes recientes
Hi,

We've installed Liferay 6.2 GA2 and problem persist. Guest users cannot change language. Any news on this issue ?
Spa Movy, modificado hace 9 años.

RE: Liferay 6.2 - guest not able to change language

New Member Mensajes: 14 Fecha de incorporación: 7/04/11 Mensajes recientes
We are using Liferay Portal Community Edition 6.2.0 CE GA1 with no chance to update (guy responsible for that just don't want to do it), so i needed to make workaround for this.
Bug LPS-42075 is marked as fixed, but after i studied source codes i think, it's not really fixed. That changes can work only with locale.prepend.friendly.url.style=3 in your portal-ext.properties.

So i make own workaround for two our languages, but this time it works with locale.prepend.friendly.url.style=0

This is code form action mapping (we are using spring portlet mvc):

        HttpServletRequest request = PortalUtil.getHttpServletRequest(actionRequest);
        HttpServletResponse response = PortalUtil.getHttpServletResponse(actionResponse);
        HttpSession session = request.getSession();
        
        //portlet parameters, language is new language, refresh is url for redirect
        String languageId = actionRequest.getParameter("language");
        String refresh = actionRequest.getParameter("refresh");

        if (!"sk_SK".equals(languageId) && !"en_US".equals(languageId)) languageId = "sk_SK";
        Locale locale = LocaleUtil.fromLanguageId(languageId);
        
        try {
            ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
            
            //this is from LR source code
            boolean persistState = ParamUtil.getBoolean(request, "persistState", true);
            
            if (themeDisplay.isSignedIn() && (persistState)) {
                //user is logged, so we need to change his language and set session Locale
                User user = themeDisplay.getUser();
                user.setLanguageId(languageId);
                UserLocalServiceUtil.updateUser(user);
                session.setAttribute(org.apache.struts.Globals.LOCALE_KEY, locale);
            } else {
                //guest here, session locale is messing things, so remove it
                session.removeAttribute(org.apache.struts.Globals.LOCALE_KEY);
            }
            
            //guest language cookie, should be set in both situations
            LanguageUtil.updateCookie(request, response, locale);
            
        } catch (SystemException ex) {
            logger.error("FATAL",ex);
            //TODO ignore?
        }
        
        //changes are applied after refresh, so we need to redirect to same url
        try {
            URL url = new URL(refresh);
            response.sendRedirect(refresh);
        } catch (MalformedURLException mue){
            logger.warn("Malformed refresh: "+refresh, mue);
            //TODO ignore?
        }
    }


And this is part od header jsp

<portlet:renderurl var="refresh" escapeXml="false" />
<portlet:actionurl var="setSkSk" escapexml="false">
    <portlet:param name="action" value="changeLanguage" />
    <portlet:param name="language" value="sk_SK" />
    <portlet:param name="refresh" value="<%= renderResponse.encodeURL(refresh)%>" />
</portlet:actionurl>
<portlet:actionurl var="setEnUs" escapexml="false">
    <portlet:param name="action" value="changeLanguage" />
    <portlet:param name="language" value="en_US" />
    <portlet:param name="refresh" value="<%= renderResponse.encodeURL(refresh)%>" />
</portlet:actionurl>

<a href="<%= renderResponse.encodeURL(setSkSk)%>">SK</a>
<a href="<%= renderResponse.encodeURL(setEnUs)%>">EN</a>
thumbnail
Olaf Kock, modificado hace 9 años.

RE: Liferay 6.2 - guest not able to change language

Liferay Legend Mensajes: 6403 Fecha de incorporación: 23/09/08 Mensajes recientes
You might want to find somebody who responsibly updates your server side software - as there might be security issues that get fixed, it's quite critical to stay on updated versions and not categorically deny upgrades.

Also, just inserting the language into the URL might work. E.g. default language: www.example.com/web/guest/home, french language: www.example.com/fr/web/guest/home
Michel Coulon, modificado hace 9 años.

RE: Liferay 6.2 - guest not able to change language

New Member Mensajes: 2 Fecha de incorporación: 17/03/15 Mensajes recientes
Hi all,

We have installed the last version of Liferay EE 6.2.10 this week and the problem seems not been fixed.

What do you do to resolve this issue ?

Thank you in advance.