Warning |
---|
This is deprecated information! |
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*.
...
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:
Code Block | ||||
---|---|---|---|---|
| ||||
{ message = "Hi in English"; } |
...
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 | ||||
---|---|---|---|---|
| ||||
<wo:WOString value="[loc: message, 'Default Message']" />
|
...