Child pages
  • WOnder-ERXLocalizer

Versions Compared

Key

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

...

ERXLocalizer provides easy KVC (Key-Value Coding) access to localization. For a short description and a full list of all available methods please see the api (http://wocommunity.org/documents/javadoc/wonder/latest/er/extensions/localization/ERXLocalizer.html).

How to use

Wiki MarkupThe easiest way to use localization in you WebObjects applications is to use Project Wonder's built-in localization support using the the localizer() method in the \ [ ERXSession\|WO:Programming__WebObjects-WOnder-ERXSession\] class. The localizer() method allows you to bind your localized language strings directly to you components. Lets say you want to localize your WebObjects application in english and german. The only thing you have to do is to create the required language resources in you application's resource directory. If you use Eclipse to develop your WebObjects applications, this is the ./Resources directory in you application root directory.
For english and german localization you need to create the following files and directories:

Code Block
Resources
   |
   +-English.lproj
   |    |
   |    +-Localizable.strings
   |
   +-German.lproj
   |    |
   |    +-Localizable.strings

...

for the Localizable.strings file in the German.lproj directory.unmigrated-wiki-markup

To use the localized strings just bind the keys to an appropriate WOComponent (assuming you inherited your Session object from \ [ ERXSession\|WO:Programming__WebObjects-WOnder-ERXSession\] in your application).

Code Block
<p>The application says: <webobject name="langHello"/> <webobject name="langWorld"/></p>

...

If you are creating UTF-8 applications, please be aware that UTF-8 support for your Localizable.strings files seems not to work. Instead of being desperate, simply convert your Localizable.strings files to UTF-16. The localized strings are shown in the correct way in your UTF-8 application. For further information see Localizing Property Labels in the Apple Developer Connection.

ERJavaMail support

By setting this property, email sent via ERJavaMail will be correctly encoded in UTF-8.

er.javamail.defaultEncoding = UTF-8