...
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']" /> |
...