To edit or add content to this Wiki, you can simply create a new account at

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »


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:

<h1>Hello World</h1>

This can be localized by replacing the static String 'Hello World' with the following WOString with a 'loc:' prefix:

<h1><wo:WOString value="[loc: message]" /></h1>

This binding says: "create a localized dynamic String using the key 'message'". Once you've created this binding in your component, you need to provide one or more 'Localizable.strings' files to provide the localized version of this message for each locale you wish to support. You can do this by creating a 'Language (Country).lproj' directory containing a 'Localizable.strings' in your application or framework's resources. For example if I want to provide a custom message for English speakers from Australia, I could create a 'English (Australia).lproj' directory containing a 'Localizable.strings' file. This file should be a .plist containing localized strings for each 'key' you have bound to. In this example, my 'Localizable.strings' contains:

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

  • 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.
  • No labels