Localizing user interface controlsAdded by IBM on June 28, 2011 | Version 1 (Original)
|You can use the Localized Resource builder to add a resource bundle to the web application.
You can use the Localized Resource builder to add a resource bundle to the web application.
Depending on the browser's locale setting, the locale-specific resource bundle gets added to the web application. For example, you can configure button labels and other non-content elements of your pages to get their values from the resource bundle.
To localize non-content elements in the web application:
- Create a resource bundle that contains the labels and related text strings to be localized.
It is a best practice to store all text for the user interface in one .properties
file or Java class.
- If you use the Data Services User Interface builder to define the pages in the model, that builder can generate one resource bundle that contains all the strings to be translated. Additionally, if you edit any of the strings, the builder keeps the resource bundle synchronized with the changes.
- The page automation builders, for example, the Data Page builder, support creation of a resource bundle.
- Use the right-click command in the Pages panel and click Export Resource Bundle to create a .properties file for the selected page.
- If the text is too long for a resource bundle, for example, a portlet help page, certain builders support translating the entire page.
If you use the Imported Page builder to bring the page into the model, the Localized Resource builder looks for the translated page beneath the location of the source HTML page.
- Add a Localized Resource builder call to the model above non-content builders in the builder call list and specify the following input values:
Resource Bundle Name
Enter the fully-qualified name of the property file or Java class that serves as the default resource bundle. For example, enter com.acme.LabelResources for the property file stored as, WEB-INF/work/source/com/acme/LabelResources.properties. Language
Store the locale-specific versions of this property in the same directory. For example, in the acme directory, you could store the Japanese version of the properties file (LabelResources_ja.properties) and the Italian version (LabelResources_it.properties).
Enter the ISO language code for the resource bundle to load. Profile this value and create a profile set (Language), a profile for each language for which you have a resource bundle, and specify the ISO code as the Language value for each profile.Country
Enter the ISO country code for the resource bundle to load. Profile this value and create a profile in an appropriate profile set (for example, Language) and specify the ISO code as the Country value for each profile.
- Apply the localization to the builders in the model.
- If you use the Data Services User Interface builder, all the user interface elements are connected to the resource keys in the resource bundle.
- If you use a Data Page builder, the builder can rely on the LocaleData variable that the Localized Resource builder creates.
- If you use the View and Form builder, specify the Resource Bundle Name input. The builder associates the field names with the resource keys in the resource bundle. The builder can also use indirect references so that localized strings can be used for the buttons
- For any button label, or similar builder call input, set the value using the reference chooser and selecting the appropriate entry from the LocaleData variable, which the Localized Resource builder call adds to the web application.
Parent topic: Localizing applications