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://webobjects.mdimension.comwocommunity.org/documents/javadoc/wonder/apilatest/er/extensions/localization/ERXLocalizer.html).

How to use

Wiki Markup
The 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:

...

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).

...

These are the default settings for ERXLocalizer:

Code Block
 er.extensions.ERXLocalizer.defaultLanguage=English
 er.extensions.ERXLocalizer.fileNamesToWatch=("Localizable.strings","ValidationTemplate.strings")
 er.extensions.ERXLocalizer.availableLanguages=(English,German)
 er.extensions.ERXLocalizer.frameworkSearchPath=(app,ERDirectToWeb,ERExtensions)

You can provide your own defaults in your application properties file or set the defaults somewhere in the initialization code of your application, e.g.

Code Block
   public Application() {
       NSLog.out.appendln("Welcome to " + this.name() + " !");
       /* ** put your initialization code in here ** */
       ERXLocalizer.setDefaultLanguage("English");
   }

...