Creating files for the new locale in Management Center

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

  1. 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
    • Feature Pack 2Feature Pack 3attachement, catalog, foundations, marketing, promotions, price, catalog filter, store
    1. Navigate through the tool subdirectory until the properties file level.
    2. 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.
    3. 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.
    4. Repeat steps a-c for each tool.
  2. 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
    • Feature Pack 2Feature Pack 3attachement, catalog, foundations, marketing, promotions, price, catalog filter, store
    1. Navigate through the tool subdirectory until the properties file level.
    2. 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.
    3. 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.
    4. Repeat steps a-c for each tool.
  3. Create a new package for the extension properties files.
    1. Start WebSphere Commerce Developer.
    2. In the Enterprise Explorer view, expand LOBTools > JavaResources:src.
    3. Right-click JavaResources:src; click New > Package.
    4. In the New Java Package window, name the new package com.mycompany.commerce.client.lobtools.properties then click Finish.
  4. In the new properties package, create a new file.
    1. Right-click com.mycompany.commerce.client.lobtools.properties package, click New > Other.
    2. In the Select a wizard window, click the General folder; click File.
    3. Name your new file ShellLOB.properties.
    4. Click Finish. The file opens in the default XML editor.
  5. 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
  6. Save and close the file.
  7. Create a new file ShellLOB_en_CA.properties.
    1. Right-click com.mycompany.commerce.client.lobtools.properties package, click New > Other.
    2. In the Select a wizard window, click the General folder; click File.
    3. Name your new file ShellLOB_en_CA.properties.
    4. Click Finish. The file opens in the default XML editor.
  8. Create a new file ShellLOB_fr_CA.properties.
    1. Right-click com.mycompany.commerce.client.lobtools.properties package, click New > Other.
    2. In the Select a wizard window, click the General folder; click File.
    3. Name your new file ShellLOB_fr_CA.properties.
    4. Click Finish. The file opens in the default XML editor.
  9. Define the new properties for en_CA locale. In the ShellLOB_en_CA.properties file, add the following code:
    languageOptionDisplayText_en_CA=Canadian English
  10. Save and close the file.
  11. Define the new properties for fr_CA locale. In the ShellLOB_fr_CA.properties file, add the following code:
    languageOptionDisplayText_fr_CA=Canadian French
  12. Save and close the file.
  13. Register the new properties in the resource bundle.
    1. Expand LOBTools > WebContent > WEB-INF > src > lzx > commerce > shell.
    2. Right-click the shell folder; then click New > Other.
    3. Name your new file shellResourceBundle_ext.lzx
    4. Click Finish. The file opens in the default XML editor.
    5. 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.
    6. Save and close the file.
  14. Register the shellResourceBundle_ext.lzx file in the shell extensions library:
    1. In the Enterprise Explorer view, go to LOBTools > WebContent > WEB-INF > src > lzx > commerce > shell
    2. Open the ShellExtensionsLibrary.lzx file.
    3. Add the following code in the <library> tag.
      <include href="./shellResourceBundle_ext.lzx" /> 
      
    4. Save and close the file.
  15. Register the en_CA and fr_CA locales in the Preferences dialog.
    1. Go to LOBTools > WebContent > WEB-INF > src > lzx > commerce > shell
    2. Open the UserPreferencePanel.lzx file.
    3. 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" /> 
    4. Save and close the file.

Results

In the next step, you will verify your customization.