Include text on the Management Center user interface,
such as in the main work area (list, properties, or calendar views),
search, explorer view, menu, message, and help text.
Rather
than hard-coding user interface text in the OpenLaszlo class
files or definition files, include all
text in resource properties files, and associate the files with resource
keys. This way, you maintain the user interface code in one area (the OpenLaszlo file or definition file) and the text in another
(properties file). This is particularly useful if you have text that
will change often, or if you support globalization in your coding
(that is, support translating the user interface text to various languages).
Procedure
- Navigate to this directory: WCDE_installdir\LOBTools\src\com\your_company_name\Management_Center_component\client\lobtools\properties.
- Create a properties file using any text editor. The file
name should have a .properties extension and you should create one
for each language, if you will have text in multiple languages (for
example myFile_en_US.properties for English text, and myFile_fr_FR.properties
for French text).
Within this file, list all the user
interface text and associate a unique key for each string of text.
For example, to include three tabs (called A, B, and C), on a the
properties view for an object, include something similar to this:
keyA=A
keyB=B
keyC=C
- Create a resource bundle to associate with the keys:
- Open
WebSphere Commerce Developer and switch to the Enterprise Explorer
view.
- In the Enterprise Explorer view,
expand , where Management_Center_component is
the name of your new custom tool.
- Create an OpenLaszlo library
file with this syntax:
Management_Center_componentResourceBundle.lzx
.
For example, MyCompanyResourceBundle. This file must be added to the
apprpriate extensions library file. Examples include, MarketingExtensionsLibrary.lzx
and FoundationsExtensionsLibrary.lzx
- Within the resource bundle library
file, define a class that extends wcfResourceBundle. It is recommended
that the class name follow this naming convention:
three-character
Management Center component code in lower caseResourceBundle
.
For example, extMyToolResourceBundle. When you create new OpenLaszlo classes,
it is recommended that you prefix the class names with ext so
that they are clearly identified as extensions.Specify
the resource bundle base name and define an instance of
lzx/commerce/foundation/restricted/ResourceBundle.lzx/wcfResourceBundleKey for
every key in the properties file. Create in the same path used in
step 1. Instantiate the resource bundle class and specify a unique
identifier that can be used to refer to the resource bundle. For example:
<library>
<class name="extMyResourceBundle" extends="wcfResourceBundle"
baseName="com.mycompany.catalog.client.lobtools.properties.MyResources">
<wcfResourceBundleKey name="keyA"/>
<wcfResourceBundleKey name="keyB"/>
<wcfResourceBundleKey name="keyC"/>
</class>
<extMyResourceBundle id="myResources"/>
</library>
Where:
- extMyResourceBundle
- The name of the resource bundle class.
- myResources
- The id used to reference the resource class in the object definition.
For example,
displayName="${myResources. ... }"
.
- Update your Management Center tool definitions to use the
resource bundle keys. The following example demonstrates the declaration
of an object definition display name that retrieves the text from
a resource bundle:
<class name="extMyObjectDefinition" extends="wcfPrimaryObjectDefinition"
displayName="${myResources.keyA.string}">
...
</class>
<PrimaryObjectDefinition definitionName="MyObjectDefinition"
displayName="${myResources.keyA}">
...
</class>
What to do next
After you complete your work:
- Right-click LOBTools Project; then click Build
OpenLaszlo Project to produce an updated ManagementCenter.swf
file under the WCDE_installdir\workspace\LOBTools\WebContent
directory. This setting is the default environment setting.
- Test your work by viewing them in the Management Center, using
this URL: https://hostname:8000/lobtools.
- Deploy
your files to your production environment.