Adding languages in Management Center

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

  1. 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
    1. Go through the tool subdirectory until the properties file level.
    2. 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.
    3. 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.
    4. Repeat these steps for each tool directory.
  2. Create the properties file for the fr_CA locale.
    1. Go through the tool subdirectories again until the properties file level.
    2. 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.
    3. 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.
    4. Repeat these steps for each tool directory.
  3. Create a 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 file called 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. 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
  9. Save and close the file.
  10. Create a file called 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.
  11. 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
  12. Save and close the file.
  13. Register the new properties in the resource bundle.
    1. Expand LOBTools > WebContent > WEB-INF > src > xml > commerce > shell.
    2. Right-click the shell folder; then, click New > Other.
    3. Name your new file ShellResourceBundle.xml
    4. Click Finish.
      The file opens in the default XML editor.
    5. 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>
    6. Save and close the file.
  14. Register the en_CA and fr_CA locales in the Preferences dialog.
    1. Go to LOBTools > WebContent > WEB-INF > src > xml > commerce > shell
    2. Open the UserPreferencePanel.xml file.
    3. 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"/>
      
    4. 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"/>
      
    5. Save and close the file.
    6. Republish the application.

Results

In the next step, you will verify your customization.