Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Aligned code description with code example.


 

Localization (aka L10n) is all about getting the right text to the user, in the right language.

...

Warning
titleAvoid BOMs

Make sure that your properties files don't contain byte order marks (BOM), because Java – and thus Tapestry – doesn't support BOM in properties files (see http://bugs.sun.com/view_bug.do?bug_id=4508058). Some editors write them out when saving a file in UTF-8, so watch out.

...


Properties File Charset

Tapestry uses the UTF-8 character set (charset) when reading the properties files in a message catalog. This means that you don't have to use the Java native2ascii tool.

...

Here, the page-title message is extracted from the catalog and passed to the Border Layout component's title parameter parameter.

In addition, the greeting message is extracted and written into the response as part of the template.

...

While your application can support any locale (and thus any language) that you want, Tapestry provides only a limited set of translations for its own built-in messages. As of Tapestry 5.3, the following locales have translations provided:

en (English)

el (Greek)

it (Italian)

pl (Polish)

sv (Swedish)

bg (Bulgarian)

es (Spanish)

ja (Japanese)

pt (Portuguese)

vi (Vietnamese)

cs (Czech)1

fi (Finnish)

mk (Macedonian)

ru (Russian)

zh (Chinese)

da (Danish)

fr (French)

nl (Dutch)

sl (Slovenian)2
 


de (German)

hr (Croatian)

no (Norwegian)

sr (Serbian)

 


as of Tapestry 5.3.8

 2 as of Tapestry 5.4

...

Fortunately, Tapestry uses all the same mechanisms for its own locale support as it provides for your application. So, to support other locales, just translate the built-in message catalog (property) files yourself: 


HTML
<style type="text/css">table.sectionMacro { width: auto; }</style>


Section
widthauto


Column




Column




To have Tapestry use these new files, just put them in the corresponding package-named directory within your own app (for example, src/main/resources/org/apache/tapestry5/core.properties).

...