Sample: Loading category descriptions in multiple languages

This sample demonstrates how to load English and French category descriptions in a single step operation, as well as a multiple step operation.

About this sample

In this sample demonstrates two ways to load multi-language category descriptions:
  • One-step operation: Load multi-language data in one step if you know the languages your store must support.
  • Two-step operation: If your requirements change, and further language support is required later on, you can add additional language support in a second step.

To view the category descriptions in French in the AuroraESite storefront, select the French option in the language list on the AuroraESite home page.

Note: For this sample to work, the store you are using must support multiple languages. The AuroraESite starter store supports multiple languages.

Procedure

To load the English and French descriptions in the one-step operation:

  1. Open the command-line interface and go to the following directory:
    • WC_installdir/bin
    • WebSphere Commerce DeveloperWCDE_installdir\bin
  2. Enter the following command:
    • LinuxAIX./dataload.sh ../samples/DataLoad/Catalog/MultiLanguages/wc-dataload-one-step-lang.xml
    • WebSphere Commerce DeveloperWindowsdataload ..\samples\DataLoad\Catalog\MultiLanguages\wc-dataload-one-step-lang.xml

To load the English and French descriptions in the two-step operation:

  1. Open the command-line interface and go to the following directory:
    • WC_installdir/bin
    • WebSphere Commerce DeveloperWCDE_installdir\bin
  2. Enter the following command:
    • LinuxAIX./dataload.sh ../samples/DataLoad/Catalog/MultiLanguages/wc-dataload-two-steps-lang.xml
    • WebSphere Commerce DeveloperWindowsdataload ..\samples\DataLoad\Catalog\MultiLanguages\wc-dataload-two-steps-lang.xml

Verifying results

The wc-dataload-one-steps-lang.xml file calls the wc-loader-catalog-group-two-langs.xml configuration file, which has mappings for both English and French descriptions. The wc-loader-catalog-group-two-langs.xml file loads categories and descriptions from the CatalogGroupWithTwoLanguageDescription.csv source file.

In the two-step operation, the wc-dataload-two-steps-lang.xml configuration file loads categories from the CatalogGroupWithFirstLanguageDescription.csv source file. This CSV file contains the English names, short descriptions, and long descriptions of the categories. The wc-dataload-two-steps-lang.xml file then calls the wc-loader-catalog-group-description.xml configuration file to load the French names, short descriptions, and long descriptions from the SecondLanguageDescription.csv source file. The loader uses the CatalogGroupDescriptionMediator mediator to create descriptions for existing categories.

The French language ID is defined in the wc-dataload-two-step-lang.xml file as follows:
<!-- Language id = -2 means French language -->
<_config:BusinessContext languageId="-2"/>
Note: You must specify the appropriate encoding to use for the languages you want to load. The character set is defined in the wc-loader-catalog-group-description.xml file as follows:
<_config:DataReader className="com.ibm.commerce.foundation.dataload.datareader.CSVReader" firstLineIsHeader="true" useHeaderAsColumnName="true"
 charset="ISO-8859-1"/>
Verify that the categories and descriptions have been loaded by running the following SQL statements:
select * from catgrpdesc where catgroup_id in 
(select catgroup_id from catgroup where identifier like 'Womens Fashion%')
You can also verify that the multi-language data has been loaded by viewing it in the Management Center or in the storefront.

Cleaning up the data

To remove the data loaded in this sample from the database, run the CleanUp.sql file in the /samples/DataLoad/Catalog/MultipleLanguages directory.