Versions Compared


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


Prior to WebObjects 5.5, creating localized content was somewhat involved and a number of frameworks added different ways of making this easier. One of the biggest problems was that you were required to maintain multiple versions of your component files (unless you were using one of the additional frameworks like wonder). WebObjects 5.5 (made available on the Apple Developer Connection as a nightly build) introduces some new support for localizing WebObjects components without having to have more than one copy of the component. Support for a new style of inline binding has been added to the framework*.


Your components can be localized by replacing static content with localized WOStrings. For example, consider the following page fragment:


Code Block
title"English (Australia).lproj/Localizable.strings"
   message = "Hi in English";

Example Project

To see how the new WebObjects 5.5 localization works, you can download the attached sample project: 'HelloWideWorld' which has a very simple main component with a localized title and heading. In the src/main/resources/Resources directory you can see a number of folders for different locales. Each of these folders contains a single 'Localizable.strings' file containing localized strings for that locale.

Optional arguments

The 'loc' bindings have some optional arguments that you can use. The only required argument is the name of the key you want a localised value for (as shown above), but you may also like to provide a default String to display in the absence of a localised version. Here's an example of how you can do this:

Code Block
title"Providing a default value"

   <wo:WOString value="[loc: message, 'Default String']" />
  • The support for the new 'loc:' binding has been added as a custom WOAssociation. WebObjects 5.4 introduced a public API for writing and registering custom WOAssocations, so you too can modify the WebObjects component parsing and introduce new binding prefixes. For more information about how this is done, refer to the Registering Custom WOAssociations page.