4.1.4.  Portlets

Warning

You are looking at documentation for an older release. Not what you want? See the current release documentation.

Portlets are independent applications and deliver their own resource files.

All shipped portlet resources are located in the locale/portlet subfolder. The ResourceBundleService parameter called classpath.resources defines this subfolder.

Example: Adding a Spanish translation to GadgetPortlet

  1. Create the GadgetPortlet_es.properties file in: WEB-INF/classes/locale/portlet/gadget/GadgetPortlet.

  2. Add Spanish as a supported-locale to portlet.xml ('es' is the 2 letters 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 the portlet internationalization.

Standard portlet resource keys

The portlet specifications define three standard keys: Title, Short Title and Keywords. Keywords are formatted as a comma-separated list of tags.

 javax.portlet.title=Breadcrumbs Portlet
 javax.portlet.short-title=Breadcrumbs
 javax.portlet.keywords=Breadcrumbs, Breadcrumb

Debugging resource bundle usage

When translating an application, it can sometimes be important to find out which key underlies some given labels in the user interface. eXo Platform offers the Magic locale to handle such situations.

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 "organization.title" value. 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.

Accessing the Magic Locale:

  1. Start the portal in debug mode by executing the following command-line argument:

    [USER@HOST jboss-jpp-6.0]$ ./bin/standalone.sh -
    Dexo.product.developing=true
  2. Open http://localhost:8080/portal/classic to display eXo Platform landing page.

  3. Click Change Language.

  4. Select ma from the list of available languages to activate the Magic locale.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus