You can use the Management Center to add the properties and resource bundle files
for new language locales. HCL Commerce defines static text such as prompt text and
messages in property files.
About this task
Management Center properties files are located in the
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 in the file name are copied and renamed to
include the en_CA and fr_CA locale name instead. A new
message key and value is created in a properties file. This information is used to display the new
language in the Management Center
Languages list.
Other HCL Commerce tools such as the administration console 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 the 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
workspace_dir\LOBTools\src\com\ibm\commerce\tool\client\lobtools\properties
directory, where
tool is the directory for a
Management Center tool. You are repeating this step for the following directories:
- attachment
- catalog
- catalogfilter
- foundation
- installment
- layout
- marketing
- pagelayout
- price
- promotion
- search
- store
- stores
- workspace
-
Go through the tool subdirectory until the properties file level.
-
Copy all the files in the properties file level that contain en_US 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, go to the
workspace_dir\LOBTools\src\com\ibm\commerce\attachment\client\lobtools\properties
directory. Copy the AttachmentLOB_en_US.properties and
AttachmentLOBErrorMessages_en_US.properties files. Rename both files to be
AttachmentLOB_en_CA.properties and
AttachmentLOBErrorMessages_en_CA.properties. Replace all occurrences of
= with =CA_ in both files.
Note: For this tutorial, the CA_ prefix is used so that when you launch the
Management Center you can validate your changes.
-
Repeat these steps for each tool directory.
-
Create the properties file for the fr_CA locale.
-
Go through the tool subdirectories again until the properties file
level.
-
Copy all the files in the properties file level that contain fr_FR 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, go to the
workspace_dir\LOBTools\src\com\ibm\commerce\attachment\client\lobtools\properties
directory. Copy the AttachmentLOB_fr_FR.properties and
AttachmentLOBErrorMessages_fr_FR.properties. Rename both files to be
AttachmentLOB_fr_CA.properties and
AttachmentLOBErrorMessages_fr_CA.properties. Replace all occurrences of
= with =CA_ in both files.
Note: For this tutorial, the CA_ prefix is used so that when you launch the
Management Center you can validate your changes.
-
Repeat these steps for each tool directory.
-
Create a 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 file called 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.
-
Define the new properties for the en_CA locale. In the
ShellLOB_en_CA.properties file, add the following code:
languageOptionDisplayText_en_CA=Canadian English
-
Save and close the file.
-
Create a file called 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 the 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.xml
-
Click Finish.
The file opens in the default XML editor.
-
Add the following code to define the custom resource bundle:
<Definitions>
<ResourceBundle baseName="com.mycompany.commerce.client.lobtools.properties.ShellLOB" definitionName="cmc/mycompany/MyShellResources" singletonDefinition="true"/>
</Definitions>
-
Save and close the file.
-
Register the en_CA and fr_CA locales in the
Preferences dialog.
-
Go to
-
Open the UserPreferencePanel.xml file.
-
Search for the following snippet
<dependency localName="shellResources"
moduleName="cmc/shell/ShellResources"/>
and add the new resource dependency on the next
line:
<dependency localName="MyShellResources" moduleName="cmc/MyCompany/MyShellResources"/>
-
Add the en_CA and fr_CA locales to the language list,
wherever you want them to appear.
<PreferenceValue package="cmc/shell" textKey="${MyShellResources.Singleton.languageOptionDisplayText_en_CA}" value="en_CA"/>
<PreferenceValue package="cmc/shell" textKey="${MyShellResources.Singleton.languageOptionDisplayText_fr_CA}" value="fr_CA"/>
-
Save and close the file.
-
Republish the application.
Results
In the next step, you will verify your customization.