Chapter 23. Navigation Tabs

Roy Russo

Thomas Heute

The navigation tabs allow users to navigate the portal pages. This section describes some of the functionality available in configuring them.

23.1. Explicit ordering of tabs

Explicit ordering of the tab display, is accomplished via page properties that are defined in your *-object.xml ( Section 6.2.1, “*-object.xml” ). Ordering is accomplished using the order tag at the page level as a page property.

<page>
   <page-name>default</page-name>
   <properties>
      <property>
         <name>order</name>
         <value>1</value>
      </property>
   </properties>
      ...
</page>

23.2. Translating tab labels

Labels on tabs can be defined in multiple languages. Two different ways can be used, the first one consist at defining several display name for page objects, the second one consists of defining a resource bundle where to find the localized display-name. Both methods have advantages and drawbacks.

23.2.1. Method one: Multiple display-name

In the *-object.xml descriptor under the page element, it is possible to define a display-name per locale. Here is an example:

<page>
   <page-name>News</page-name>
   <display-name xml:lang="en">News</display-name>
   <display-name xml:lang="it">Novita'</display-name>
   <display-name xml:lang="es">Noticias</display-name>
   <display-name xml:lang="fr">Actualités</display-name>
   ...
</page>
         

Here we defined a display name for four different languages. The advantage of this method is that it is simple and the display name is kept along the metadata. The drawback of this method is that if you may end up with different places to keep your localized data. If you are using resource bundles for other elements, the second method might be simpler when you add new supported languages.

23.2.2. Defining a resource bundle and supported locales

If you are already using resource bundles for localization you may prefer to point to those files. To do so you can define the name of your ressource bundle. The files should be in the classloader of the war containing the *-object.xml where you define them, meaning in the same war file.

Here is an example:

<page>
   <page-name>Weather</page-name>
   <supported-locale>fr</supported-locale>
   <supported-locale>en</supported-locale>
   ...
</page>
        

With one or the other method, accessing the portal will now display the tab names with the preferred locale if a localized value exists.

Warning

If you change the values in the descriptor (method 1) or in the resource bundles (method 2) you need to use the <if-exists>overwrite</if-exists> so that the values are updated