Chapter 25. Portal Configuration

25.1. Configuring Permissions

The default permission configuration for the portal is defined through the org.exoplatform.portal.config.UserACL component configuration in the JPP_HOME/gatein/gatein.ear/portal.war/WEB-INF/conf/portal/portal-configuration.xml file.
It defines nine permissions types:
super.user
The super user has all the rights on the platform, this user is referred to as root.
portal.administrator.groups
Any member of those groups are considered administrators. Default value is /platform/administrators.
portal.administrator.mstype
Any user with that membership type would be considered administrator or the associated group. Default value is manager.
portal.creator.groups
This list defines all groups that will be able to manage the different portals. Members of this group also have the permission to create new portals. The format is membership:/group/subgroup.
user.impersonate.groups
This list defines all groups that will be able to impersonate as other user. The format is membership:/group/subgroup.
navigation.creator.membership.type
Defines the membership type of group managers. The group managers have the permission to create and edit group pages and they can modify the group navigation.
guests.group
Any anonymous user automatically becomes a member of this group when they enter the public pages.
mandatory.groups
Groups that cannot be deleted.
mandatory.mstypes
Membership types that cannot be deleted.

Example 25.1.  Permission configuration

<component>
  <key>org.exoplatform.portal.config.UserACL</key>
  <type>org.exoplatform.portal.config.UserACL</type>
  <init-params>
 
    <value-param>
      <name>super.user</name>
      <description>administrator</description>
      <value>root</value>
    </value-param>
 
    <value-param>
      <name>portal.creator.groups</name>
      <description>groups with membership type have permission to manage portal</description>
      <value>*:/platform/administrators,*:/organization/management/executive-board</value>
    </value-param>
 
    <value-param>
      <name>navigation.creator.membership.type</name>
      <description>specific membership type have full permission with group navigation</description>
      <value>manager</value>
    </value-param>
 
    <value-param>
      <name>guests.group</name>
      <description>guests group</description>
      <value>/platform/guests</value>
    </value-param>
 
    <value-param>
      <name>access.control.workspace</name>
      <description>groups with memberships that have the right to access the User Control Workspace</description>
      <value>*:/platform/administrators,*:/organization/management/executive-board</value>
    </value-param>
 
  </init-params>
</component>

25.2. Overwrite Portal Default Permissions

When creating custom portals and portal extensions it is possible to override the default configuration by using org.exoplatform.portal.config.PortalACLPlugin, configuring it as an external component plug-in of org.exoplatform.portal.config.UserACL service:

 <external-component-plugins>
    <target-component> org.exoplatform.portal.config.UserACL</target-component>
    <component-plugin>
      <name> addPortalACLPlugin </name>
      <set-method> addPortalACLPlugin</set-method>
      <type>org.exoplatform.portal.config.PortalACLPlugin</type>
      <description>setting some permission for portal</description>
      <init-params>
        <values-param>
          <name>access.control.workspace.roles</name>
          <value>*:/platform/administrators</value>
          <value>*:/organization/management/executive-board</value>
        </values-param>
        <values-param>
          <name>portal.creation.roles</name>
          <value>*:/platform/administrators</value>
          <value>*:/organization/management/executive-board</value>
        </values-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>

25.3. Portal Navigation

25.3.1. Configuring Portal Navigation

There are three types of navigation available to portal users:
  • Portal_Navigation
  • Group_Navigation
  • User_Navigation
These navigators are configured using the standard XML syntax in JPP_HOME/gatein/gatein.ear/portal.war/WEB-INF/conf/portal/portal-configuration.xml.

	
<component>
  	<key>org.exoplatform.portal.config.UserPortalConfigService</key>
  	<type>org.exoplatform.portal.config.UserPortalConfigService</type>
  	<component-plugins>
    	<component-plugin>
       <name>new.portal.config.user.listener</name>
       <set-method>initListener</set-method>
       <type>org.exoplatform.portal.config.NewPortalConfigListener</type>
       <description>this listener init the portal configuration</description>
       <init-params>
          <value-param>
             <name>default.portal</name>
             <description>The default portal for checking db is empty or not</description>
             <value>classic</value>
          </value-param>
          <value-param>
             <name>page.templates.location</name>
             <description>the path to the location that contains Page templates</description>
             <value>war:/conf/portal/template/pages</value>
          </value-param>
          <value-param>
             <name>override</name>
             <description>The flag parameter to decide if portal metadata is overriden on restarting server</description>
             <value>false</value>
          </value-param>
          <object-param>
             <name>site.templates.location</name>
             <description>description</description>
             <object type="org.exoplatform.portal.config.SiteConfigTemplates">
                <field name="location">
                   <string>war:/conf/portal</string>
                </field>
                <field name="portalTemplates">
                   <collection type="java.util.HashSet">
                      <value><string>basic</string></value>
                      <value><string>classic</string></value>
                   </collection>
                </field>
                <field name="groupTemplates">
                   <collection type="java.util.HashSet">
                      <value><string>group</string></value>
                   </collection>
                </field>
                <field name="userTemplates">
                   <collection type="java.util.HashSet">
                      <value><string>user</string></value>
                   </collection>
                </field>
             </object>
          </object-param>
          <object-param>
             <name>portal.configuration</name>
             <description>description</description>
             <object type="org.exoplatform.portal.config.NewPortalConfig">
                <field name="predefinedOwner">
                   <collection type="java.util.HashSet">
                      <value><string>classic</string></value>
                   </collection>
                </field>
                <field name="ownerType">
                   <string>portal</string>
                </field>
                <field name="templateLocation">
                   <string>war:/conf/portal/</string>
                </field>
                <field name="importMode">
                   <string>conserve</string>
                </field>
             </object>
          </object-param>
          <object-param>
             <name>group.configuration</name>
             <description>description</description>
             <object type="org.exoplatform.portal.config.NewPortalConfig">
                <field name="predefinedOwner">
                   <collection type="java.util.HashSet">
                      <value><string>/platform/administrators</string></value>
                      <value><string>/platform/users</string></value>
                      <value><string>/platform/guests</string></value>
                      <value><string>/organization/management/executive-board</string></value>
                   </collection>
                </field>
                <field name="ownerType">
                   <string>group</string>
                </field>
                <field name="templateLocation">
                   <string>war:/conf/portal</string>
                </field>
                <field name="importMode">
                   <string>conserve</string>
                </field>
             </object>
          </object-param>
          <object-param>
             <name>user.configuration</name>
             <description>description</description>
             <object type="org.exoplatform.portal.config.NewPortalConfig">
                <field name="predefinedOwner">
                   <collection type="java.util.HashSet">
                      <value><string>root</string></value>
                      <value><string>john</string></value>
                      <value><string>mary</string></value>
                      <value><string>demo</string></value>
                      <value><string>user</string></value>
                   </collection>
                </field>
                <field name="ownerType">
                   <string>user</string>
                </field>
                <field name="templateLocation">
                   <string>war:/conf/portal</string>
                </field>
                <field name="importMode">
                   <string>conserve</string>
                </field>
             </object>
          </object-param>
       </init-params>
    </component-plugin>
  </component-plugins>
</component>
This XML configuration defines where in the portal's WAR to look for configuration settings, and which portals, groups, and user specific views to include in portal/group/user navigation.
The first time the portal is launched those files will be used to create an initial navigation. That information will then be stored in the JCR content repository and can be modified and managed from the portal UI.

25.3.2. Setting up Navigation

Each portal, groups and users navigation is indicated by a <object-params> configuration directive.

Example 25.2. Navigation Configuration Directives

<object-param>
   <name>portal.configuration</name>
   <description>description</description>
   <object type="org.exoplatform.portal.config.NewPortalConfig">
      <field name="predefinedOwner">
         <collection type="java.util.HashSet">
            <value><string>classic</string></value>
         </collection>
      </field>
      <field name="ownerType">
         <string>portal</string>
      </field>
      <field name="templateLocation">
         <string>war:/conf/portal/</string>
      </field>
      <field name="importMode">
         <string>conserve</string>
      </field>
   </object>
</object-param>
predefinedOwner defines the navigation owner, portal will look for the configuration files in folder with this name, if there is no suitable folder, a default portal will be created with name is this value.
ownerType defines the type of portal navigation. It may be a portal, group, or user.
templateLocation defines the classpath to all portal configuration files
importMode is the mode for navigation import. There are 4 types of import mode:
  • conserve: Import data when it does not exist, otherwise do nothing.
  • insert: Import data when it does not exist, otherwise performs a strategy that adds new data only.
  • merge: Import data when it does not exist, update data when it exists.
  • rewrite: Overwrite data whatsoever.
Based on these parameters, the portal looks for the configuration files, and creates the relevant portal navigation, pages, and data import strategy.
  • Portal configuration files are stored in the folder structures {templateLocation}/{ownerType}/{predefinedOwner}.
  • Portal navigations are defined in the navigation.xml file.
  • Portal pages are defined in pages.xml file.
  • Portal configuration is defined in portal.xml file.
With the above configuration, the portal will look for all configuration files contained within the war:/conf/portal/portal/classic directory.

25.3.3. Portal Navigation

The portal navigation incorporates the pages that can be accessed even when a user is not logged in (assuming the applicable permissions allow public access). For example; several portal navigations could be used when a company has multiple trademarks, and websites are set up for each of them.
The Classic portal is configured by three XML files in the JPP_HOME/gatein/gatein.ear/portal.war/WEB-INF/conf/portal/portal/classic directory:
portal.xml
This file describes the layout and portlets that will be shown on all pages. Usually the layout contains the banner, footer, menu and breadcrumbs portlets. The portal is extremely configurable as every view element (even the banner and footer) is a portlet.

	
<portal-config
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2"
 xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
	<portal-name>classic</portal-name>
	<locale>en</locale>
	<access-permissions>Everyone</access-permissions>
	<edit-permission>*:/platform/administrators</edit-permission>
	<properties>
	  <entry key="sessionAlive">onDemand</entry>
	  <entry key="showPortletInfo">1</entry>
	</properties>

	<portal-layout>
	  <portlet-application>
	     <portlet>
	        <application-ref>web</application-ref>
	        <portlet-ref>BannerPortlet</portlet-ref>
	        <preferences>
	           <preference>
	              <name>template</name>
	              <value>par:/groovy/groovy/webui/component/UIBannerPortlet.gtmpl</value>
	              <read-only>false</read-only>
	           </preference>
	        </preferences>
	     </portlet>
	     <access-permissions>Everyone</access-permissions>
	     <show-info-bar>false</show-info-bar>
	  </portlet-application>
	
	  <portlet-application>
	     <portlet>
	        <application-ref>web</application-ref>
	        <portlet-ref>NavigationPortlet</portlet-ref>
	     </portlet>
	     <access-permissions>Everyone</access-permissions>
	     <show-info-bar>false</show-info-bar>
	  </portlet-application>
	
	  <portlet-application>
	     <portlet>
	        <application-ref>web</application-ref>
	        <portlet-ref>BreadcumbsPortlet</portlet-ref>
	     </portlet>
	     <access-permissions>Everyone</access-permissions>
	     <show-info-bar>false</show-info-bar>
	  </portlet-application>
	
	  <page-body> </page-body>
	
	  <portlet-application>
	     <portlet>
	        <application-ref>web</application-ref>
	        <portlet-ref>FooterPortlet</portlet-ref>
	        <preferences>
	           <preference>
	              <name>template</name>
	              <value>par:/groovy/groovy/webui/component/UIFooterPortlet.gtmpl</value>
	              <read-only>false</read-only>
	           </preference>
	        </preferences>
	     </portlet>
	     <access-permissions>Everyone</access-permissions>
	     <show-info-bar>false</show-info-bar>
	  </portlet-application>
	
	</portal-layout>
 
</portal-config>
It is also possible to apply a nested container that can also contain portlets. Row, column or tab containers are then responsible for the layout of their child portlets.
Each application references a portlet using the id portal#{portalName}:/{portletWarName}/{portletName}/{uniqueId}.
Use the page-body tag to define where the portal should render the current page.
The defined classic portal is accessible to "Everyone" (at /portal/classic) but only members of the group /platform/administrators can edit it.
navigation.xml
This file defines all the navigation nodes the portal will have. The syntax is simple and uses nested node tags. Each node references a page defined in pages.xml file.
To create node labels for each language, use the label tag with the xml:lang attribute with the value of the relevant locale.
Otherwise, to have the node label localized by resource bundle files, use the #{...} syntax: the enclosed property name serves as a key that is automatically passed to internationalization mechanism which replaces the literal property name with a localized value from the associated properties file matching the current locale.

	<node-navigation
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2"
   xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
   <priority>1</priority>
   <page-nodes>
      <node>
         <name>home</name>
         <label xml:lang="en">Home</label>
         <page-reference>portal::classic::homepage</page-reference>
      </node>
      <node>
         <name>sitemap</name>
         <label xml:lang="en">SiteMap</label>
         <visibility>DISPLAYED</visibility>
         <page-reference>portal::classic::sitemap</page-reference>
      </node>
<!-- Additional content removed for readability -->
   </page-nodes>
</node-navigation>

Warning

For top nodes, the uri and the name of your navigation nodes must have the same value. For other nodes the uri is a relative path.
For example; contentmanagement/fileexplorer where 'contentmanagement ' is the name of the parent node and 'fileexplorer' is the name of the node (<name>fileexplorer</name>).
This navigation tree can be accessed from within portlets. This allows different presentations to be provided within portlets such as breadcrumb menus, sitemaps, or pop-up menus. Further examples of this can be found in the source tree of the portal itself.
The <priority> directive is an optional property that controls navigation ordering priority within the UI. The greater the value, the more weight the navigation has when the toolbar renders. If the directive is not declared, the element is allocated a default value of -1, which sets the navigation element to "undefined" when editing the navigation UI.
pages.xml
This configuration file structure is very similar to portal.xml and can also contain container elements. Further usage examples of container elements can be found in JPP_HOME/gatein/gatein.ear/portal.war/WEB-INF/conf/portal/portal/sharedlayout.xml.
Each portlet application can decide whether to render the portlet border, the window state, the icons, or the portlet mode.

<page-set
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2 http://www.gatein.org/xml/ns/gatein_objects_1_2"
   xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
   <page>
      <name>homepage</name>
      <title>Home Page</title>
      <access-permissions>Everyone</access-permissions>
      <edit-permission>*:/platform/administrators</edit-permission>
      <portlet-application>
         <portlet>
            <application-ref>web</application-ref>
            <portlet-ref>HomePagePortlet</portlet-ref>
            <preferences>
               <preference>
                  <name>template</name>
                  <value>system:/templates/groovy/webui/component/UIHomePagePortlet.gtmpl</value>
                  <read-only>false</read-only>
               </preference>
            </preferences>
         </portlet>
         <title>Home Page portlet</title>
         <access-permissions>Everyone</access-permissions>
         <show-info-bar>false</show-info-bar>
         <show-application-state>false</show-application-state>
         <show-application-mode>false</show-application-mode>
      </portlet-application>
   </page>
 
   <page>
      <name>sitemap</name>
      <title>Site Map</title>
      <access-permissions>Everyone</access-permissions>
      <edit-permission>*:/platform/administrators</edit-permission>
      <portlet-application>
         <portlet>
            <application-ref>web</application-ref>
            <portlet-ref>SiteMapPortlet</portlet-ref>
         </portlet>
         <title>SiteMap</title>
         <access-permissions>Everyone</access-permissions>
         <show-info-bar>false</show-info-bar>
      </portlet-application>
   </page>
   ...
</page-set>

25.3.4. Group Navigation

Group navigations are dynamically added to the user navigation at login. This allows users to see the pages assigned to any groups they belong to in the menu.
The group navigation menu is configured in the navigation.xml and pages.xml files. The syntax used in these files is the same as those covered in the portal navigation directives covered in Section 25.3.3, “Portal Navigation”.
Group navigation directives are located in the JPP_HOME/gatein/gatein.ear/portal.war/WEB-INF/conf/portal/group/group-name-path/ directory. For example, portal.war/WEB-INF/conf/portal/group/platform/administrators/ for the admin group.

25.3.5. User Navigation

User navigation is the set of nodes and pages that are owned by a user. They are part of the user's dashboard.
Two files configure the user navigation (navigation.xml and pages.xml). They are located in the directoryJPP_HOME/gatein.ear/portal.war/WEB-INF/conf/portal/user/{userName}.
The example below shows a dashboard with all of the default gadgets included, as well as an extra currency converter gadget sourced from Google Gadgets.

	 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extras/gadgets.xml" parse="text"/> 

25.4. Default Configuration for JBoss Portal

25.4.1. Setting up Default Configuration for JBoss Portal

The default home page URL is http://{hostname}:{port}/portal/. There may be multiple independent portal containers deployed in parallel at any given time, each of which has its root context (http://{hostname}:{port}/sample-portal/, for example).
Each portal container is internally composed of one or more 'portals'. This is because there needs to be at least one such portal available. The default portal is called 'Classic'. When accessing the default URL, you are automatically directed to the 'Classic' portal.
The default portal performs another important task. When starting up the portal for the first time, its JCR database (where portal runtime-configurable settings are stored) will be empty . The default portal detects this and triggers automatic data initialization.

25.4.2. Configuring Classic Portal

The following example configuration can be found at: JPP_HOME/gatein/gatein.ear/portal.war/WEB-INF/conf/portal/portal-configuration.xml.

 
<component>
  <key>org.exoplatform.portal.config.UserPortalConfigService</key>
  <type>org.exoplatform.portal.config.UserPortalConfigService</type>
  <component-plugins>
    <component-plugin>
      <name>new.portal.config.user.listener</name>
      <set-method>initListener</set-method>
      <type>org.exoplatform.portal.config.NewPortalConfigListener</type>
      <description>this listener init the portal configuration</description>
      <init-params>
        <value-param>
          <name>default.portal</name>
          <description>The default portal for checking db is empty or not</description>
          <value>classic</value>
        </value-param>
        ...
      </init-params>
    </component-plugin>
  </component-plugins>
</component>
In this example the Classic portal has been set as the default.
Notice that the NewPortalConfigListener component-plug-in is used to add configuration to UserPortalConfigService, which is designed in this way to allow other components to add configuration to it.
Components, component-plugins, and init-params are explained in The eXo Kernel in the Development Guide.

25.4.3. Using Component Plugins

In some cases, portal definitions and portal template definitions are defined but not used any more. To delete them, it is possible to add a component plug-in to JPP_HOME/gatein/gatein.ear/portal.war/WEB-INF/conf/portal/portal-configuration.xml which detects these definitions and cleans up the portal-configuration.xml file automatically.

Example 25.3. Using Component Plugins

<external-component-plugins>
  <target-component>org.exoplatform.portal.config.UserPortalConfigService</target-component>
  <component-plugin>
    <name>new.portal.config.user.listener</name>
    <set-method>deleteListenerElements</set-method>
    <type>org.exoplatform.portal.config.NewPortalConfigListener</type>
    <description>this listener delete some predefined portal and templates configuration</description>
    <init-params>
      <object-param>
        <name>site.templates.location</name>
        <description>description</description>
        <object type="org.exoplatform.portal.config.SiteConfigTemplates">
          <field name="portalTemplates">
            <collection type="java.util.HashSet">
              <value>
                <string>basic</string>
              </value>
              <value>
                <string>classic</string>
              </value>
            </collection>
          </field>
        </object>
      </object-param>
      <object-param>
        <name>portal.configuration</name>
        <description>description</description>
        <object type="org.exoplatform.portal.config.NewPortalConfig">
          <field  name="predefinedOwner">
            <collection type="java.util.HashSet">
              <value><string>classic</string></value>
            </collection>
          </field>
          <field name="ownerType"><string>portal</string></field>
        </object>
      </object-param>
    </init-params>
  </component-plugin>
</external-component-plugins>

25.4.4. Setting up Information Bar

You can set the info bar shown by default for portlets of a portal by adding an <entry> directive to the <properties> configuration of the JPP_HOME/gatein/gatein.ear/portal.war/WEB-INF/conf/portal/portal/classic/portal.xml file.
<properties>
  <entry key="showPortletInfo">1</entry>
</properties>
There are two values for "showPortletInfo": 0 and 1. If the value is 1, the info bar of portlets is shown by default. If the value is 0, it is hidden.

25.4.5. Disabling Portal Container

Once you have created a custom portal container that meets requirements, consider disabling a default portal container that is no longer required.

Procedure 25.1. Disable an Unused Portal Container

  1. Add the following configuration to the configuration.xml of the custom extension in order to disable a portal container:
     
    <!-- Comment 1 -->
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
      xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
      <external-component-plugins>
    <!-- The full qualified name of the PortalContainerConfig -->
        <target-component>org.exoplatform.container.definition.PortalContainerConfig
        </target-component>
        <component-plugin>
    <!-- The name of the plug-in -->
            <name>Add PortalContainer Definitions</name>
    <!-- (existing configuration for new portal container) -->
        </component-plugin>
        <component-plugin>
    <!-- The name of the plug-in -->
              <name>Disable a PortalContainer</name>
    <!-- The name of the method to call on the PortalContainerConfig in order to register the changes on the PortalContainerDefinitions -->
              <set-method>registerDisablePlugin</set-method>
    <!-- The full qualified name of the PortalContainerDefinitionDisablePlugin -->
              <type>org.exoplatform.container.definition.PortalContainerDefinitionDisablePlugin</type>
              <init-params>
    <!-- The list of the name of the portal containers to disable -->
            <values-param>
              <name>names</name>
              <value>$PORTAL_NAME</value>
            </values-param>
          </init-params>
        </component-plugin>                
      </external-component-plugins>
    </configuration>
  2. The portal name declared in the <values-param> directive will no longer be available at http://{hostname}:{port}/portal.

Note

Disabling the default portal container is possible, but not recommended. Some functions, such as WSRP or Services Management, depend on the default portal container to be deployed. These functions will no longer work if the default portal container is disabled.

25.5. Internationalization Configuration

The portal is fully configurable for internationalization, however users should have a general knowledge of Internationalization in Java products before attempting these configurations. Oracle hosts a comprehensive guide to internationalizing Java products at http://docs.oracle.com/javase/tutorial/i18n/TOC.html.
All portal applications contain property files for various languages. They are packaged with the portlets applications in a WEB-INF/classes/locale/ directory.
These files are located in the classes folder of the WEB-INF directory, so as to be loaded by the ClassLoader.
All resource files are in a sub-folder named locale.
For instance; the translations for the NavigationPortlet are located in web.war/WEB-INF/classes/locale/portlet/portal
 NavigationPortlet_de.properties
NavigationPortlet_en.properties
NavigationPortlet_es.properties
NavigationPortlet_fr.properties
NavigationPortlet_nl.properties
NavigationPortlet_ru.properties
NavigationPortlet_uk.properties
NavigationPortlet_ar.xml
Inside those file are typical key=value Java EE properties. For example; in the Spanish file:
javax.portlet.title=Portlet de navegaci\u00f3n
There are also properties files in the portal itself. They form the portal resource bundle.
From a portlet you can then access translations from the portlet itself or shared at the portal level, both are aggregated when you need them.

Note

It is also possible to use a proprietary XML format to define translations. This is a more convenient way to translate a document for some languages such as Japanese, Arabic or Russian.
Property files must be ISO 8859-1 encoded, while the XML file can define its encoding. As a result it is easier for a person to read a translation in XML instead of having to decode and encode the property file.
For more information see XML Resources Bundles in the Development Guide.

25.5.1. Configuring Locales

Various languages are available in the portal package. The configuration below will define which languages are shown in the "Change Language" section and made available to users.
The JPP_HOME/gatein/gatein.ear/portal.war/WEB-INF/conf/common/common-configuration.xml file of your installation contains the following section:

  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extras/default149.xml" parse="text"/> 
This configuration points to the locale configuration file.
The locale configuration file (portal.war:/WEB-INF/conf/common/locales-config.xml) contains the following code:

Example 25.4. The locales-config.xml File Explanation


  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="extras/default150.xml" parse="text"/> 
locale: The locale has to be defined as per the codes defined here. In this example ar is Arabic.
output-encoding: deals with character encoding. It is recommended that UTF-8 be used.
input-encoding: In the Java implementation, the encoding parameters will be used for the request response stream. The input-encoding parameter will be used for request setCharacterEncoding(..).
description: A description of the language.
orientation: Although the default orientation of text and images is Left-To-Right, the portal supports Right-To-Left orientation. Modifying text orientation is explained in Right To Left RTL Framework in Development Guide.

25.5.2. Configuring Resource Bundle Service

The resource bundle service is configured in: JPP_HOME/gatein/gatein.ear/portal.war/WEB-INF/conf/common/common-configuration.xml:

Example 25.5. The common-configuration.xml file explained


<component>
  <key>org.exoplatform.services.resources.ResourceBundleService</key>
  <type>org.exoplatform.services.resources.impl.SimpleResourceBundleService</type>
  <init-params>
  <!-- Comment #1 -->
    <values-param>
      <name>classpath.resources</name>
      <description>The resources that start with the following package name should be loaded from the file system</description>
      <value>locale.portlet</value>
    </values-param>
    <!-- Comment #2 -->
    <values-param>
      <name>init.resources</name>
      <description>Initiate the following resources during the first launch</description>
      <value>locale.portal.expression</value>
      <value>locale.portal.services</value>
      <value>locale.portal.webui</value>
      <value>locale.portal.custom</value>
      <value>locale.navigation.portal.classic</value>
      <value>locale.navigation.group.platform.administrators</value>
      <value>locale.navigation.group.platform.users</value>
      <value>locale.navigation.group.platform.guests</value>
      <value>locale.navigation.group.organization.management.executive-board</value>
    </values-param>
    <!-- Comment #3 -->
    <values-param>
      <name>portal.resource.names</name>
      <description>The properties files of  the portal ,  those file will be merged
        into one ResoruceBundle properties </description>
      <value>locale.portal.expression</value>
      <value>locale.portal.services</value>
      <value>locale.portal.webui</value>
      <value>locale.portal.custom</value>
    </values-param>
  </init-params>
</component>
Comment #1
Resources whose package name starts with the name specified in the classpath.resources parameter are loaded from the file system. Detailed information can be found in a later section of this chapter.
Comment #2
Resources related to portal, group, and user reference bundles
Comment #3
The portal.resource.names parameter defines all resources that belong to the Portal Resource Bundle. These resources are merged to a single resource bundle which is accessible from anywhere in the portal. All these keys are located in the same bundle, which is separated from the navigation resource bundles.

25.5.3. Configuring Navigation Resource Bundles

There is a resource bundle for each navigation. A navigation can exist for user, groups, and portal.
Section 25.5.2, “Configuring Resource Bundle Service” shows bundle definitions for the navigation of the classic portal and of four different groups. Each of these resource bundles occupies a different sphere, they are independent of each other and they are not included in the portal.resource.names parameter.
The properties for a group must be in the JPP_HOME/gatein/gatein.ear/portal.war/WEB-INF/classes/locale/navigation/group/ folder. For example, JPP_HOME/gatein/gatein.ear/portal.war/WEB-INF/classes/locale/navigation/group/organization/management/executive-board_en.properties.
The folder and file names must correspond to the group hierarchy. The group name "executive-board" is followed by the ISO 639 code.
Each language defined in LocalesConfig must have a resource file defined. If the name of a group is changed the name of the folder and/or files of the correspondent navigation resource bundles must also be changed.
Content of executive-board_en.properties:
organization.title=Organization
organization.newstaff=New Staff
organization.management=Management
This resource bundle is only accessible for the navigation of the organization.management.executive-board group.

25.6. Portlets

25.6.1. Configuring Portlets

Portlets are independent applications and deliver their own resource files. All shipped portlet resources are located in the locale/portlet sub-folder. The ResourceBundleService parameter classpath.resources defines this sub-folder.

Procedure 25.2. Add Spanish Translation to the GadgetPortlet

  1. Create the file GadgetPortlet_es.properties in JPP_HOME/gatein/gatein.ear/portal.war/WEB-INF/classes/locale/portlet/gadget/GadgetPortlet.
  2. In portlet.xml, add Spanish as a supported-locale ('es' is the two letter code for Spanish). The resource-bundle is already declared and is the same for all languages :
    <supported-locale>en</supported-locale>
    <supported-locale>es</supported-locale>
    <resource-bundle>locale.portlet.gadget.GadgetPortlet</resource-bundle>
See the portlet specification for more details about portlet internationalization.

25.6.2. Standard Portlet Resource Keys

The portlet specification defines three standard keys: Title, Short Title and Keywords. Keywords is formatted as a comma-separated list of tags.
javax.portlet.title=Breadcrumbs Portlet
 javax.portlet.short.title=Breadcrumbs
 javax.portlet.keywords=Breadcrumbs, Breadcrumb

25.6.3. Debugging Resource Bundle Usage

When translating an application it can sometimes be difficult to find the right key for a given property. You can start the Portal in debug mode and use the Magic locale from the list of available portal languages to assist in finding the correct translated key value. This special locale translates a key to the same value. For example, the translated value for the "organization.title" key is the value "organization.title". Selecting Magic locale allows use of the portal and its applications with all the keys visible. This makes it easier to discover the correct key for a given label in the portal page.

Procedure 25.3. Accessing the Magic Locale

  1. Start the portal in debug mode by executing the following command-line argument:
    
    [<replaceable>USER</replaceable>@<replaceable>HOST</replaceable> jboss-jpp-6.1;]$ ./bin/standalone.sh -Dexo.product.developing=true
    
  2. Open http://localhost:8080/portal/classic to display the Portal Platform landing page.
  3. Click Change Language.
  4. Select ma from the list of available languages to activate the Magic locale.

25.6.4. Translating the Language Selection Form

Image displaying the available languages in the portal, with French selected.

Figure 25.1. Language Selection Screen

When choosing a language from the Language Select screen, the user is presented with a list of languages on the left side in the current chosen language. On the right side, the same language is translated into its own language.
The local language values are obtained from the JDK API java.util.Locale.getDisplayedLanguage() and java.util.Locale.getDisplayedCountry() (if needed). Not all languages may be translated, and the languages available can also depend on the JVM currently used.
It is possible to override these values by editing the locale.portal.webui resource bundle.

25.6.5. Overriding Default JDK API Language Values

Procedure 25.4. Overriding Default JDK API Language Values

  1. Edit the JPP_HOME/gatein/gatein.ear/portal.war/WEB-INF/classes/locale/portal/webui_xx_yy.properties file where xx_yy represents the country code of the language you wish to translate.
  2. In that file, add or modify a key such as Locale.xx_yy with the xx_yy value being the translated string.
  3. Edit JPP_HOME/gatein/gatein.ear/portal.war/WEB-INF/classes/locale/portal/webui_fr.properties where fr is the country code for French, and add the following key into it:
    Locale.zh_TW=Chinois traditionnel
When the portal is next restarted, the localized language will be updated in the user interface when a user tries to change the current language.