Forums de discussion

Remove the message that links to current page in other language

Enrico Borsoi, modifié il y a 9 années.

Remove the message that links to current page in other language

New Member Publications: 10 Date d'inscription: 20/11/13 Publications récentes
Hi all,
i would like to remove the message that appear on top of the page when an user is viewing a page that is not in his preferred language.

To make an example I login to the portal, set english as my preferred language (on "My account" page), then if I view the site in italian on the top of the page I see a message that says "This page is displayed in Italian (Italy). Display the page in English (United States). Set Italian (Italy) as your preferred language."

How can I remove this message? Apart from hiding the div through css obviously... Is there any configuration parameter?

Thank you in advance!
thumbnail
Andew Jardine, modifié il y a 9 années.

RE: Remove the message that links to current page in other language

Liferay Legend Publications: 2416 Date d'inscription: 22/12/10 Publications récentes
Enrico,

I don't think that is configurable, but you could make it configurable! Take some of the source from the resulting page and do a search through the liferay source to find the jsp that injects the message. You can then create a JSP hook and inject logic so that based on a configuration in the portal-ext file, the message will either hide or show. You can use the PrefsPropsUtil class to retrieve a setting from the portal-ext. Some something like --


<% 
    boolean showPreferredLangugageWarning = PrefsPropsUtil.getBoolean( "show.preferred.language.warning" );

    pageContext.setAttribute("preferredLanguageWarning", showPreferredLangugageWarning);
%>

<c:if test="${ showPreferredLangugageWarning }">
   <!-- html to show warning here -->
</c:if>



.. then you just have to add the show.preferred.language.warning option to your portal-ext.properties file.
thumbnail
Michele Zanarotti, modifié il y a 8 années.

RE:[UPDATED]Remove the message that links to current page in other language

Junior Member Publications: 94 Date d'inscription: 20/02/12 Publications récentes
I had the same problem I and i want to add some info.

UPDATE : the page that is responsible for the inclusion of the message box is :
html/common/themes/top_messages.jsp (Here you can comment or manage the inclusion of the user_lcale_options.jsp file). I deed this specifically:

// Commenting adding warning message for the different locale
//if ((PropsValues.LOCALE_PREPEND_FRIENDLY_URL_STYLE == 3) &amp;&amp; !user.isDefaultUser() &amp;&amp; (user.getLocale() != locale)) {
//    PortalUtil.addUserLocaleOptionsMessage(request);
//}


Obviously you can use a stored portal preference to manage this.

As i tested, it's not needed to edit the user_locale_options file at all (as I thought before), because you'll end up with an cyan box in the top of page and you cannot remove it.

The page is configurable via hook. In Liferay 6.2 the jsp is in :
html/common/themes/user_locale_options.jsp

You should be fine in removing almost everything from this file or disable the if logic in some way.
GAURAV TIWARI, modifié il y a 7 années.

RE: RE:[UPDATED]Remove the message that links to current page in other lang

New Member Envoyer: 1 Date d'inscription: 28/01/16 Publications récentes
commenting lines in html/common/themes/top_messages.jsp worked for me. Thanks