First we will do this manually. In every project you can set the resource bundle option. Default is one resource bundle per project.




First we have to make a xml with the resource values which matches our attributes of an ADF datacontrol class or an ADF BC object .
<?xml version='1.0'?>
<Mod>
<Ent name="Data" package="nl.whitehorses.model">
<Att name="lovLabel">
<Msg label="label" tip="label in nederlands"/>
<Msg lang="en" label="label" tip="label in english"/>
</Att>
<Att name="lovValue">
<Msg label="waarde" tip="Dutch for value"/>
<Msg lang="en" label="value" tip="Engels voor waarde"/>
</Att>
</Ent>
<Ent name="Data2" package="nl.whitehorses.model">
<Att name="lovLabel">
<Msg label="label" tip="label in nederlands"/>
<Msg lang="en" label="label" tip="label in english"/>
</Att>
<Att name="lovValue">
<Msg label="waarde" tip="Dutch for value"/>
<Msg lang="en" label="value" tip="Engels voor waarde"/>
</Att>
</Ent>
</Mod>
Put your xml file with the xslt file and the ant scripts in the root folder of your model project. The xslt file will generate the java resource bundles. Change the build.properties file and set your jdeveloper 11g home. Now we can run the ant scripts. Here you can download the required files.
The generated java resourcebundle looks like this.
package nl.whitehorses.model.common;
// CODE GENERATED BY XSLT From AllMessages.xml - Do Not Edit This File.
import oracle.jbo.common.JboResourceBundle;
public class DataImplMsgBundle_en extends JboResourceBundle {
public DataImplMsgBundle_en() {
}
public Object[][] getContents() {
return super.getMergedArray(sMessageStrings, super.getContents());
}
static final Object[][] sMessageStrings = {
{"lovLabel_LABEL","label"},
{"lovLabel_TOOLTIP","label in english"},
{"lovValue_LABEL","value"},
{"lovValue_TOOLTIP","Engels voor waarde"}
};
}
You can see that label resource has the following name convention attributename_LABEL.
Now we only have to add this resource to the ADF datacontrol class xml file. Open the xml and go the structure window and a ResourceBundle element with a JavaResourceBundle child element.

That's all.
No comments:
Post a Comment