In this lesson, you will add the properties
and resource bundle files for the new locale. WebSphere Commerce defines
static text such as prompt text and messages in properties file.
About this task
Management Center properties file are located in WCDE_installdir\workspace\LOBTools\src\com\ibm\commerce directory.
Each locale owns its own set of properties files. New properties files
need to be created to reflect the language description for each new
locale you created for your customization task. All the files with
the locale name "en_US" embedded in the file name will be copied and
renamed to include the "en_CA" and "fr_CA locale name instead. A new
message key and value will be created in a properties file. This information
is used to display the new language in the Management Center Languages list.
Other
WebSphere Commerce tools such as WebSphere Commerce Accelerator also
uses properties files to display the content. You can use a similar
approach to add en_CA and fr_CA to those tools as well.
Procedure
- Create the properties file for en_CA locale.
Locale
specific messages for Management Center are stored in properties files.
These properties files are grouped by the Management Center tool and
each tool has a separate directory for its properties files. The properties
files can be found in
WCDE_installdir\workspace\LOBTools\src\com\ibm\commerce\tool\client\lobtools\properties directory,
where
tool is the directory
for a Management Center tool. You will be repeating this step for
the following directories:
- attachement, catalog, foundations, marketing, promotions
- attachement, catalog, foundations,
marketing, promotions, price, catalog filter, store
- Navigate through the tool subdirectory
until the properties file level.
- Copy all the files in the properties file level that
has "en_US" embedded in the file name. In each copied file, replace
"en_US" with "en_CA" in the file name.
- Within each file, replace all occurrences of = with
prefix =CA_.
For example,
navigate to the WCDE_installdir\workspace\LOBTools\src\com\ibm\commerce\catalog\client\lobtools\properties directory.
Copy the files CatalogLOB_en_US.properties and CatalogLOBErrorMessages_en_US.properties.
Rename both files to be CatalogLOB_en_CA.properties and CatalogLOBErrorMessages_en_CA.properties
respectively. Replace all occurrences of "=" with "=CA_" in both files.
Note: For
the purpose of this tutorial, the "CA_" prefix is used so that when
you access Management Center you can validate your changes.
- Repeat steps a-c for each tool.
- Create the properties file for fr_CA locale.
Locale
specific messages for Management Center are stored in properties files.
These properties files are grouped by the Management Center tool and
each tool has a separate directory for its properties files. The properties
files can be found in
WCDE_installdir\workspace\LOBTools\src\com\ibm\commerce\tool\client\lobtools\properties directory,
where
tool is the directory
for a Management Center tool. You will be repeating this step for
the following directories:
- attachement, catalog, foundations, marketing, promotions
- attachement, catalog, foundations,
marketing, promotions, price, catalog filter, store
- Navigate through the tool subdirectory
until the properties file level.
- Copy all the files in the properties file level that
has "fr_FR" embedded in the file name. In each copied file, replace
"fr_FR" with "fr_CA" in the file name.
- Within each file, replace all occurrences of = with
prefix =CA_.
For example,
navigate to the WCDE_installdir\workspace\LOBTools\src\com\ibm\commerce\catalog\client\lobtools\properties directory.
Copy the files CatalogLOB_fr_FR.properties and CatalogLOBErrorMessages_fr_FR.properties.
Rename both files to be CatalogLOB_fr_CA.properties and CatalogLOBErrorMessages_fr_CA.properties
respectively. Replace all occurrences of "=" with "=CA_" in both files.
Note: For
the purpose of this tutorial, the "CA_" prefix is used so that when
you access Management Center you can validate your changes.
- Repeat steps a-c for each tool.
- Create a new package for the extension properties files.
- Start
WebSphere Commerce Developer.
- In the Enterprise Explorer view, expand .
- Right-click JavaResources:src;
click .
- In the New Java Package window,
name the new package com.mycompany.commerce.client.lobtools.properties then
click Finish.
- In the new properties package, create a new file.
- Right-click com.mycompany.commerce.client.lobtools.properties package,
click .
- In the Select
a wizard window, click the General folder;
click File.
- Name your new
file ShellLOB.properties.
- Click Finish.
The file opens in the default XML editor.
- Define new properties for en_CA and fr_CA locales. In the ShellLOB.properties file,
add the following code:
languageOptionDisplayText_en_CA=Canadian English
languageOptionDisplayText_fr_CA=Canadian French
- Save and close the file.
- Create a new file ShellLOB_en_CA.properties.
- Right-click com.mycompany.commerce.client.lobtools.properties package,
click .
- In the Select
a wizard window, click the General folder;
click File.
- Name your new file ShellLOB_en_CA.properties.
- Click Finish.
The file opens in the default XML editor.
- Create a new file ShellLOB_fr_CA.properties.
- Right-click com.mycompany.commerce.client.lobtools.properties package,
click .
- In the Select
a wizard window, click the General folder;
click File.
- Name your new file ShellLOB_fr_CA.properties.
- Click Finish.
The file opens in the default XML editor.
- Define the new properties for en_CA locale. In the ShellLOB_en_CA.properties file,
add the following code:
languageOptionDisplayText_en_CA=Canadian English
- Save and close the file.
- Define the new properties for fr_CA locale. In the ShellLOB_fr_CA.properties file,
add the following code:
languageOptionDisplayText_fr_CA=Canadian French
- Save and close the file.
- Register the new properties in the resource bundle.
- Expand .
- Right-click the shell folder; then click .
- Name your new file shellResourceBundle_ext.lzx
- Click Finish. The file opens
in the default XML editor.
- Define the new resource bundle class and create an instance
of it. In the shellResourceBundle_ext.lzx file,
add the following code:
<library>
<class name="wcfShellResourceBundleExt" extends="wcfResourceBundle" baseName="com.mycompany.commerce.client.lobtools.properties.ShellLOB">
<wcfResourceBundleKey name="languageOptionDisplayText_en_CA" />
<wcfResourceBundleKey name="languageOptionDisplayText_fr_CA" />
</class>
<wcfShellResourceBundleExt id="shellResourceBundleExt"/>
</library>
The
wcfResourceBundle
class represents
a resource bundle object within the OpenLaszlo and maps the corresponding
content in the properties files.
- Save and close the file.
- Register the shellResourceBundle_ext.lzx file
in the shell extensions library:
- In the Enterprise Explorer view, go to
- Open the ShellExtensionsLibrary.lzx file.
- Add the following code in the
<library>
tag.
<include href="./shellResourceBundle_ext.lzx" />
- Save and close the file.
- Register the en_CA and fr_CA locales in the Preferences dialog.
- Go to
- Open the UserPreferencePanel.lzx file.
- Search for
<class name="wcfLanguageList"
.
Add the following code before the </class> tag.<wcfPreferenceValue textKey="${shellResourceBundleExt.languageOptionDisplayText_en_CA}" value="en_CA" />
<wcfPreferenceValue textKey="${shellResourceBundleExt.languageOptionDisplayText_fr_CA}" value="fr_CA" />
- Save and close the file.
Results
In the next step, you will verify your customization.