|Oracle® Fusion Middleware Skin Editor User's Guide for Oracle Application Development Framework
11g Release 1 (126.96.36.199.0)
Part Number E21420-02
This chapter describes how to work with text in an ADF skin.
This chapter includes the following sections:
The source file for an ADF skin does not store any text that ADF Faces components render in the user interface of your application. Applications that render ADF Faces components abstract the text that these components render as resource strings and store the resource strings in resource bundles. For example, Figure 7-1 shows an ADF Faces
dialog component that renders command buttons with OK and Cancel labels.
The text that appears as the labels for these command buttons (OK and Cancel) is defined in a resource bundle and referenced by a resource string. If you want to change the text that appears in the command button labels, you create a resource bundle where you define the values that you want to appear by specifying alternative text for the following resource strings:
Note:By default, a resource bundle (
skinBundle.properties) is created in your project when you create a new ADF skin, as described in Section 4.4, "Creating an ADF Skin File."
In addition to the resource strings that define the text to appear in the user interface for specific components, there are a range of resource strings that define text to appear that is not specific to any particular component. These resource strings are referred to as global resource strings. For more information about the resource strings for ADF Faces components and global resource strings, see the Oracle Fusion Middleware Tag Reference for Oracle ADF Faces Skin Selectors.
ADF Faces components provide automatic translation. The resource bundle used for the ADF Faces components' skin is translated into 28 languages. If, for example, an end user sets the browser to use the German (Germany) language, any text contained within the components automatically displays in German. For this reason, if you create a resource bundle for a new ADF skin, you must also create localized versions of that resource bundle for any other languages your web application supports.
For more information about creating resource bundles, resource strings, and localizing ADF Faces components, see the "Internationalizing and Localizing Pages" chapter in the Oracle Fusion Middleware Web User Interface Developer's Guide for Oracle Application Development Framework.
If you enter alternative text in a resource bundle to override the default text values that render in the user interface of the ADF Faces components in your application, you need to specify this resource bundle for your application. At runtime, the application renders the alternative text in your resource bundle for the resource strings that you override. For resource strings that you do not override, the application renders the text defined in the base resource bundle. For example, Figure 7-4 shows an ADF Faces dialog component where the application developer overrides the default value for the
af_dialog.LABEL_OK resource string from
Yay while the default value for the
af_dialog.LABEL_CANCEL resource string remains unchanged. That is, the application developer did not define a value for the
af_dialog.LABEL_CANCEL resource string in a resource bundle; the application references the base resource bundle for this resource string's value.
For more information about how to create a resource bundle and how to define string key values, see the "Internationalizing and Localizing Pages" chapter in the Oracle Fusion Middleware Web User Interface Developer's Guide for Oracle Application Development Framework.
You specify a resource bundle for your ADF skin by adding its name and location as a value to the
bundle-name property in the
To specify an additional resource bundle for an ADF skin:
In the Application Navigator, double-click the
trinidad-skins.xml file for your application. By default, this is under the Web Content/WEB-INF node.
In the Structure window, right-click the skin node for which you want to add an additional resource bundle and choose Insert inside skin > bundle-name.
In the Property Inspector, specify the name and location for your resource bundle as a value for the
For example, the resource bundle that is created by default after you create the first ADF skin in your project, as illustrated in Figure 7-3, specifies the following value for the
trinidad-skins.xml file references the resource bundle that you specified as a value for the
bundle-name property, as shown in Example 7-1.
Example 7-1 Specifying an Additional Resource Bundle in trinidad-skins.xml
<skin> <id>skin1.desktop</id> <family>skin1</family> <extends>fusionFx-simple-v1.desktop</extends> <render-kit-id>org.apache.myfaces.trinidad.desktop</render-kit-id> <style-sheet-name>skins/skin1/skin1.css</style-sheet-name> <bundle-name>resources.skinBundle</bundle-name> </skin>
At runtime, the application renders text values that you specified in your resource bundle to override the default text values. For example, assume that you defined a resource bundle where you specified
Yeah as the value for the
af_dialog.LABEL_OK resource sting and
Oops as the value for the
af_dialog.LABEL_CANCEL. Example 7-1 shows a
dialog component that renders labels using these values.