Wednesday August 23, 2006 |
Isopaleocopria
Gregory Murphy's Blogorrhea |
|
|
DataProvider component for internationalizing Creator applications The JavaServer Faces standard JSP tag library includes the In the meantime, I have put together a simple DataProvider component, PropertyResourceProvider, which plays the same role, but has much better design-time support. How to install the PropertyResourceProvider Download the PropertyResourceProvider complib to a local directory. From within Creator, open up Tools -> Component Library Manager, and click on "Import". Use the browse feature to locate the downloaded component library, and select it. The library contains a single component, PropertyResourceProvider, which you can import into its own category, or into a pre-existing category. How to use the PropertyResourceProvider A PropertyResourceProvider wraps a Java resource bundle file, and makes the keys in the bundle file appear as data fields. In general, you should use one PropertyResourceProvider per resource bundle file. The component has a single property, The overhead involved in creating a PropertyResourceProvider is minimal, so it is probably easiest to add them to each page on which they are needed. Localizable component values will need to be added to a resource bundle, instead of being set directly on the component. There are a number of ways of adding new keys to a resource bundle file. You can click on the file in the project view to edit it directly (look under the Source Packages node), or you open the file node and right click on a locale node to add key and value pairs, one by one. To bind a component to a localizable value, right-click on the component and choose "Bind to Data". Select the appropriate PropertyResourceProvider, and the keys currently defined in the resource file will appear as fields. Select a field, and Creator will set the property's value to an expression that binds to the selected field. Close the binding window, and you will see the property value appear in the designer. PropertyResourceProvide is just like any other DataProvider, so you can also edit property values in the component's properites sheet, or by choosing the "Property Bindings..." context menu item. The PropertyResourceProvider will automatically choose the correct bundle file to load based on the locale of the Faces context for each request. This locale is determined by examining the client locale of the incoming HTTP request, and the list of supported locales given in the application's faces-config file. Typically, adding a locale to a project involves two steps:
Hope this helps! (2006-08-23 15:36:49.0) Permalink Comments [4] Post a Comment: Comments are closed for this entry. |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Posted by Matthias Unverzagt on August 28, 2006 at 08:17 PM PDT #
Posted by Gregory Murphy on August 28, 2006 at 09:20 PM PDT #
Posted by Matthias Unverzagt on August 29, 2006 at 09:33 PM PDT #
This is a bug which I will fix for the next version. Thanks for pointing it out!
Posted by 192.18.43.249 on August 31, 2006 at 09:17 AM PDT #