留言板

Liferay 6.2 - guest not able to change language

Helder Silva,修改在10 年前。

Liferay 6.2 - guest not able to change language

New Member 帖子: 2 加入日期: 13-12-20 最近的帖子
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,修改在10 年前。

RE: Liferay 6.2 - guest not able to change language

New Member 发布: 1 加入日期: 12-8-18 最近的帖子
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,修改在10 年前。

RE: Liferay 6.2 - guest not able to change language

Liferay Legend 帖子: 3089 加入日期: 08-10-28 最近的帖子
Hi Helder,

it's a known bug:

https://issues.liferay.com/browse/LPS-42075
asif aftab,修改在10 年前。

RE: Liferay 6.2 - guest not able to change language

Regular Member 帖子: 123 加入日期: 13-9-2 最近的帖子
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,修改在10 年前。

RE: Liferay 6.2 - guest not able to change language

Liferay Legend 帖子: 3089 加入日期: 08-10-28 最近的帖子
You can patch source code yourself looking for changes in github, or ask for Liferay support.
asif aftab,修改在10 年前。

RE: Liferay 6.2 - guest not able to change language

Regular Member 帖子: 123 加入日期: 13-9-2 最近的帖子
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,修改在10 年前。

RE: Liferay 6.2 - guest not able to change language

Junior Member 帖子: 63 加入日期: 13-3-6 最近的帖子
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,修改在10 年前。

RE: Liferay 6.2 - guest not able to change language

Liferay Master 帖子: 541 加入日期: 08-12-1 最近的帖子
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,修改在10 年前。

RE: Liferay 6.2 - guest not able to change language

Junior Member 帖子: 63 加入日期: 13-3-6 最近的帖子
Thanks!! I will download it.

best regards
Helder Silva,修改在10 年前。

RE: Liferay 6.2 - guest not able to change language

New Member 帖子: 2 加入日期: 13-12-20 最近的帖子
Thank you Jeffrey.
Helder
Francesc Domenech,修改在10 年前。

RE: Liferay 6.2 - guest not able to change language

New Member 帖子: 4 加入日期: 12-3-12 最近的帖子
Hi,

We've installed Liferay 6.2 GA2 and problem persist. Guest users cannot change language. Any news on this issue ?
Spa Movy,修改在9 年前。

RE: Liferay 6.2 - guest not able to change language

New Member 帖子: 14 加入日期: 11-4-7 最近的帖子
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,修改在9 年前。

RE: Liferay 6.2 - guest not able to change language

Liferay Legend 帖子: 6403 加入日期: 08-9-23 最近的帖子
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,修改在9 年前。

RE: Liferay 6.2 - guest not able to change language

New Member 帖子: 2 加入日期: 15-3-17 最近的帖子
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.