掲示板

Liferay 6.2 - guest not able to change language

10年前 に Helder Silva によって更新されました。

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?
10年前 に Bunel Moise によって更新されました。

RE: Liferay 6.2 - guest not able to change language

New Member 投稿: 1 参加年月日: 12/08/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
10年前 に Juan Gonzalez によって更新されました。

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
10年前 に asif aftab によって更新されました。

RE: Liferay 6.2 - guest not able to change language

Regular Member 投稿: 123 参加年月日: 13/09/02 最新の投稿
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
10年前 に Juan Gonzalez によって更新されました。

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.
10年前 に asif aftab によって更新されました。

RE: Liferay 6.2 - guest not able to change language

Regular Member 投稿: 123 参加年月日: 13/09/02 最新の投稿
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
10年前 に Gabriel Bustos Padilla によって更新されました。

RE: Liferay 6.2 - guest not able to change language

Junior Member 投稿: 63 参加年月日: 13/03/06 最新の投稿
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
10年前 に Jeffrey Handa によって更新されました。

RE: Liferay 6.2 - guest not able to change language

Liferay Master 投稿: 541 参加年月日: 08/12/01 最新の投稿
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
10年前 に Gabriel Bustos Padilla によって更新されました。

RE: Liferay 6.2 - guest not able to change language

Junior Member 投稿: 63 参加年月日: 13/03/06 最新の投稿
Thanks!! I will download it.

best regards
10年前 に Helder Silva によって更新されました。

RE: Liferay 6.2 - guest not able to change language

New Member 投稿: 2 参加年月日: 13/12/20 最新の投稿
Thank you Jeffrey.
Helder
10年前 に Francesc Domenech によって更新されました。

RE: Liferay 6.2 - guest not able to change language

New Member 投稿: 4 参加年月日: 12/03/12 最新の投稿
Hi,

We've installed Liferay 6.2 GA2 and problem persist. Guest users cannot change language. Any news on this issue ?
9年前 に Spa Movy によって更新されました。

RE: Liferay 6.2 - guest not able to change language

New Member 投稿: 14 参加年月日: 11/04/07 最新の投稿
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
9年前 に Olaf Kock によって更新されました。

RE: Liferay 6.2 - guest not able to change language

Liferay Legend 投稿: 6403 参加年月日: 08/09/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
9年前 に Michel Coulon によって更新されました。

RE: Liferay 6.2 - guest not able to change language

New Member 投稿: 2 参加年月日: 15/03/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.