Version 1


    Martin Weiler


    This portlet demonstrates how to use the to switch the language of the Portal. The idea is to offer a portlet with just a few flags, which act as language switch buttons, instead of the language selection popup currently provided by GateIn.


    The main part using the LocaleConfigService can be found in the processAction method of the portlet, where the desired language is being passed in as parameter:


        LocaleConfigService localeConfigService = 
            (LocaleConfigService) PortalContainer.getInstance().getComponentInstanceOfType(LocaleConfigService.class);
        LocaleConfig localeConfig = localeConfigService.getLocaleConfig(language.toLowerCase());
        if (localeConfig == null)
            localeConfig = localeConfigService.getDefaultLocaleConfig();
        PortalRequestContext prqCtx = PortalRequestContext.getCurrentInstance();


    For the display of the flags, portlet preferences are being used. At startup, these are read from portlet.xml (see below), and can be changed at runtime using the portlets edit mode:


            <!-- a comma-delimited string of all flags that should be displayed -->      


    Just note that the 'supported.languages' value is based on the flag icons that are included in the portlet, but could be extended if necessary.

    Installation procedure

    1. Get a copy of the source with GIT: git clone git://
    2. Type 'mvn package'
    3. Copy target/languageSwitchPortlet.war into the deploy directory of GateIn/EPP

    Build system: Maven

    Source location: GIT at

    Compatibility list (please add to this list if you have tested a new version of GateIn):


    TesterVersion of the exampleVersion of GateInResultComment
    Martin Weiler1.0.0GateIn 3.1.0KOorg.exoplatform.portal.application.PortalRequestContext has no method setLocale
    Martin Weiler1.0.0GateIn 3.2 (trunk)OK
    Martin Weiler1.0.0EPP 5.1OK