Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

WORK IN PROGRESS, NEEDS FORMATTING.

 In order

Internationalisation is about users being presented with interfaces that are displayed in their preferred language. If your portlet provides options for a user to configure the portlet, or displays headings and other strings on screen, this is an essential step. And it is simple!

For your portlet to support multiple languages, your portlet needs to have all hardcoded strings must be moved into a properties file. This properties file can then be translated into various languages.Your  Your portlet then refers to the keys within the properties keyfile, instead of rather than the actual text using . To accomplish this we use the JSTL fmt tag library, which is part of the core JSTL.

For example. Instead of the following:

<p>This is some text</p>

We would do the following:

Move the string into , the following is a hardcoded string and will only ever appear in the language it is written in.

Code Block
<p>This is some text</p>

In order to fix this we need to first move these strings into a properties file where it can be translated, then add some additional setup to our pages to read the correct language version of the text into our page.

First, create a properties file. Conventionally this is called messages.properties but it can be called anything.

...