O'Reilly logo

GateIn Cookbook by Piergiorgio Lucidi, Luca Stancapiano, Ken Finnigan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the user locale to localize portlet content

In this recipe, we will modify the portlet to use property files for user interface text and create a German language version of them so that we can switch to the German locale and see the appropriate text displayed in the portlet.

Getting ready

The following are required for this recipe:

  • Apache Maven
  • An IDE of your choice
  • GateIn-3.2.0.Final
  • HelloWorldPortlet project from the Creating a portlet with the Portlet 2.0 Specification recipe

How to do it...

To recognize the locale being used in the portal, and to support internationalized messages, do the following:

  1. Add the following into portlet.xml after </supports>:
     <supported-locale>en</supported-locale> <supported-locale>de</supported-locale> <resource-bundle>gatein.cookbook.chapter6.HelloWorldPortlet</resource-bundle> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required