Configuring bootstrap files

In this lesson, you are configuring the bootstrap files required to support the new languages to your WebSphere Commerce instance. You must update the main bootstrap file and create the multi-language bootstrap files and load the files to add the language support.

In this step of the tutorial, you complete the following tasks: customize bootstrap files to include a new locale; create multi-language bootstrap files. The list of supported languages is defined in the LANGUAGE table. To support a new language, you must first add the language to this table. The wcs.bootstrap_base.xml file includes language entry elements for all locales available in WebSphere Commerce.
Note: Bootstrap files are XML files used to populate database tables with information, after the schema is created.

About this task

WebSphere Commerce comes with many languages ready to be used by a store. Each language is associated with a particular country. In this tutorial, you load Canadian languages and the Canadian currency. First, locate the wcs.bootstrap_base.xml file within the WCDE_installdir\schema\xml\ directory and include the new store languages. You can reuse an entry in the file:
<language language_id="&en_US;" localename="en_US" language="en" country="US" encoding="UTF-8" mimecharset="iso-8859-1" />
Note: When you specify the language_id value for your new language, use a negative numerical value starting at -1000 . Do not use values from -1 to -999 because these values are reserved for IBM use.
Update attributes for Canadian English and Canadian French languages:
language_id
An identifier to uniquely identify the display format.
language
The name of the language.
en
English
fr
French
country
The country or region for the language.
CA represents Canada
localename
A Java locale used to represent a political, geographical, or cultural region that has a distinct language and customs for formatting. The localename is the two-letter ISO 639 language code, followed by the two-letter ISO 3166 country code, separated by an underscore.
The language value and the country value separated by an underscore (_).
encoding
The character encoding value that the browser uses to display the page for this language. This should be the same encoding value used in your property files.
UTF-8
mimecharset
The character encoding used for MIME messaging. This value is different from the value used by browsers. For example, the de-facto character encoding for MIME messaging in Japan is iso-2022-jp, while the most commonly used character encoding in all other applications is Shift_JIS. in this example the following mimcharsets is used:
iso-8859-1
iso-8859-15
The resulting language entries for Canada are:
 <language language_id="&en_CA;" localename="en_CA" language="en" country="CA" encoding="UTF-8" mimecharset="iso-8859-1" /> 
 <language language_id="&fr_CA;" localename="fr_CA" language="fr" country="CA" encoding="UTF-8" mimecharset="iso-8859-15" /> 

The following steps are required to update and reload the main WebSphere Commerce bootstrap file:

Procedure

  1. Create the bootstrap files for your new languages.
    In these steps, for the variable myLang, use the locale name, for example, en_CA or fr_CA.
    1. Go to the following directory:
      • SolarisLinuxAIXWindowsWC_installdir\schema\xml\
      • WebSphere Commerce DeveloperWCDE_installdir\schema\xml\
    2. Create a bootstrap file called wcs.bootstrap_myLang.xml and open the file for editing.
    3. Add the following code:
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE import SYSTEM "wcs.dtd" [
      <!ENTITY bootbase SYSTEM "./wcs.bootstrap_myLang_base.xml">
      
      ]>
      <import>
      &bootbase;
      
      </import>
    4. Save and close the file.
    5. Create a bootstrap file called wcs.bootstrap_myLang_base.xml and open the file for editing.
    6. Open the wcs.bootstrap_base.xml.
    7. Search for the following element in the wcs.bootstrap_base.xml file:
       <language language_id="&en_US;" localename="en_US" language="en" country="US" encoding="UTF-8" mimecharset="iso-8859-1" /> 
    8. In the new wcs.bootstrap_myLang_base.xml file, create two language element entries modeled after the language in your wcs.bootstrap_base.xml file. This enables bootstrap files to reference the language primary keys:
      <language language_id="&en_CA;" localename="en_CA" language="en" country="CA" encoding="UTF-8" mimecharset="iso-8859-1" />
      <language language_id="&fr_CA;" localename="fr_CA" language="fr" country="CA" encoding="UTF-8" mimecharset="iso-8859-15" />
    9. Search for the following element in the wcs.bootstrap_base.xml:
      <langpair storeent_id="-1" language_id="&en_US;" language_id_alt="&en_US;" sequence="100" />
    10. In the new wcs.bootstrap_myLang_base.xml file, create two language pair element entries modeled after the language in your wcs.bootstrap_base.xml file .
      <langpair storeent_id="-1" language_id="&en_CA;" language_id_alt="&en_US;" sequence="100" />
      <langpair storeent_id="-1" language_id="&fr_CA;" language_id_alt="&en_US;" sequence="100" />
    11. Check your results:
      • Your wcs.bootstrap_en_CA_base.xml file should look like this:
        <language language_id="&en_CA;" localename="en_CA" language="en" country="CA" encoding="UTF-8" mimecharset="iso-8859-1" />
        <langpair storeent_id="-1" language_id="&en_CA;" language_id_alt="&en_US;" sequence="100" />
      • Your wcs.bootstrap_fr_CA_base.xml file should look like this:
        <language language_id="&fr_CA;" localename="fr_CA" language="fr" country="CA" encoding="UTF-8" mimecharset="iso-8859-15" />
        <langpair storeent_id="-1" language_id="&fr_CA;" language_id_alt="&en_US;" sequence="100" />
    12. Save your changes to the wcs.bootstrap_myLang_base.xml files and close the files.
  2. Edit the wcs.dtd file:
    1. Go to the following directory and locate the wcs.dtd file:
      • SolarisLinuxAIXWindowsWC_installdir\schema\xml\
      • WebSphere Commerce DeveloperWCDE_installdir\schema\xml\
    2. Backup of the file and rename the backup wcs.dtd.original.
    3. Open the wcs.dtd file. Find the line:
      <!ENTITY en_US "-1">
    4. Add these entries:
      <!ENTITY en_CA "-24">
      <!ENTITY fr_CA "-25">
    5. Save this file.
  3. Load the main bootstrap files:
    1. Download and extract the compressed file included in this tutorial, and locate the env.bat file.
    2. Open the env.bat file in a text editor and update the file to represent your environment, specifically the following properties:
      processType
      Change to wcde for WebSphere Commerce Developer, otherwise runtime. The default value of pleaseUpdate prompts you to enter a value.
      WCSHOME
      The file path to the WebSphere Commerce directory when runtime is indicated.
      WCDEHome
      The file path to the WebSphere Commerce Developer directory when wcde is indicated.
      mainBootstrap
      The file path to the bootstrap data for both languages created in this tutorial. This value is updated and ran for both the wcs.bootstrap_en_CA.xml and wcs.bootstrap_fr_CA.xml files.
      For example, if you are using WebSphere Commerce Developer, your env.bat file might resemble the following snippet:
      
      ::
      :: setenv
      ::
      :: Set environment for running sample code.
      ::
      :: Modify the variables below as necessary
      :: to match your environment.
      ::
      
      @echo off
      :: Database information for your database
      set DBNAME=dbname
      set DBUSER=dbuser
      set DBPWD=dbpwd
      
      :: processType will be 'wcde' for WCDE and 'runtime' for server
      set processType=wcde
      
      :: checks the process type you set above
      if "%processType%" == "wcde" goto wcdeusage
      if "%processType%" == "runtime" goto runtimeusage  
      if "%processType%" == "pleaseUpdate" goto  pleaseUpdateMessage       
      
      :pleaseUpdateMessage
      echo Please update "processType" parameter in env.bat to indicate whether WCDE or Runtime environmemt is used  
      goto end
      
      :wcdeusage
      :: Development Environment install directory
      set WCDEHOME=W:\WCDE_INT70
      set fileDir=%WCDEHOME%
      goto defineFiles
      
      :runtimeusage
      :: WebSphere Commerce install directory
      set WCSHOME=C:\WebSphere\CommerceServer70
      set fileDir=%WCSHOME%
      set PATH=.;%WCSHOME%\bin;%WCSHOME%\schema\xml;%PATH%
      
      goto defineFiles
      
      :defineFiles
      1set mainBootstrap=%fileDir%\schema\xml\wcs.bootstrap_myLang.xml
      set enCABootstrap=%fileDir%\schema\xml\wcs.bootstrap_multi_en_CA.xml
      set frCABootstrap=%fileDir%\schema\xml\wcs.bootstrap_multi_fr_CA.xml
      goto end
      
      :end
      
      :
      
      Note: Remember the file name that is being entered in to the mainBootstrap 1 line. The file name is changed and run again.
    3. Open a command prompt, browse to the directory where you extracted the included compressed file.
    4. Run the script massload_main.bat, where the mainBootstrap file name value of 1 is wcs.bootstrap_en_CA.xml:
      
      set mainBootstrap=%fileDir%\schema\xml\wcs.bootstrap_en_CA.xml
    5. Open the env.bat file in a text editor again and update the file to instead use the wcs.bootstrap_fr_CA.xml value for the mainBootstrap file name value of 1:
      
      set mainBootstrap=%fileDir%\schema\xml\wcs.bootstrap_fr_CA.xml
  4. Create multilanguage bootstrap files for Canadian English:
    1. Go to the following directory and locate the wcs.bootstrap_multi_en_US_base.xml file:
      • SolarisLinuxAIXWindowsWC_installdir\schema\xml\
      • WebSphere Commerce DeveloperWCDE_installdir\schema\xml\
    2. Make a copy of this file and name the copy wcs.bootstrap_multi_en_CA_base.xml
    3. Open the wcs.bootstrap_multi_en_CA_base.xml file. Replace all references from &en_US; to &en_CA;. This change references the new locale multi base file.
    4. Search for <languageds language_id="&en_CA;" description="United States English" language_id_desc="-1" />
    5. Create two languageds element entries. The value of the description displays on store pages and in the WebSphere Commerce tools when a user selects a language.
      <languageds language_id="&en_CA;" description="Canadian English" language_id_desc="-24" />
      <languageds language_id="&en_CA;" description="Canadian French"  language_id_desc="-25" />
    6. Add language descriptions for all other supported languages to allow other languages to have a translation for this locale:
      <languageds language_id="-1" description="Canadian English" language_id_desc="&en_CA;" />
      <languageds language_id="-2" description="Canadian English" language_id_desc="&en_CA;" /> 
      <languageds language_id="-3" description="Canadian English" language_id_desc="&en_CA;" /> 
      <languageds language_id="-4" description="Canadian English" language_id_desc="&en_CA;" /> 
      <languageds language_id="-5" description="Canadian English" language_id_desc="&en_CA;" /> 
      <languageds language_id="-6" description="Canadian English" language_id_desc="&en_CA;" /> 
      <languageds language_id="-7" description="Canadian English" language_id_desc="&en_CA;" /> 
      <languageds language_id="-8" description="Canadian English" language_id_desc="&en_CA;" /> 
      <languageds language_id="-9" description="Canadian English" language_id_desc="&en_CA;" /> 
      <languageds language_id="-10" description="Canadian English" language_id_desc="&en_CA;" /> 
      <languageds language_id="-20" description="Canadian English" language_id_desc="&en_CA;" /> 
      <languageds language_id="-21" description="Canadian English" language_id_desc="&en_CA;" /> 
      <languageds language_id="-22" description="Canadian English" language_id_desc="&en_CA;" /> 
      <languageds language_id="-23" description="Canadian English" language_id_desc="&en_CA;" /> 
      <languageds language_id="-24" description="Canadian English" language_id_desc="&en_CA;" /> 
      <languageds language_id="-25" description="Canadian English" language_id_desc="&en_CA;" /> 
      
      
      Note: Alternately, you could add supported languages in each of the wcs.bootstrap_multi_locale_base.xml files.
    7. Save this file.
  5. Create multilanguage bootstrap files for Canadian French:
    1. Go to the following directory and locate the wcs.bootstrap_multi_fr_FR_base.xml file:
      • SolarisLinuxAIXWindowsWC_installdir\schema\xml\
      • WebSphere Commerce DeveloperWCDE_installdir\schema\xml\
    2. Make a copy of this file and name the copy wcs.bootstrap_multi_fr_CA_base.xml
    3. Open the wcs.bootstrap_multi_fr_CA_base.xml file. Replace all references of &fr_FR; to &fr_CA; (value used in language_id).
    4. Search for <languageds language_id="&fr_CA;" description="French" language_id_desc="-2" />
    5. Create two languageds element entries under that line in order to allow the Canadian English language to translate other languages:
      <languageds language_id="&fr_CA;" description="Canadian English" language_id_desc="-25" />
      <languageds language_id="&fr_CA;" description="Canadian French" language_id_desc="-25" />
      
    6. Add language descriptions for all other supported languages to allow other languages to have a translation for this locale. Instead of updating every wcs.bootstrap_multi_locale_base.xml file, you must provide an entry for each locale within the Canadian French locale file.
      <languageds language_id="-1" description="Canadian French" language_id_desc="&fr_CA;" />
      <languageds language_id="-2" description="Canadian French" language_id_desc="&fr_CA;" />
      <languageds language_id="-3" description="Canadian French" language_id_desc="&fr_CA;" />
      <languageds language_id="-4" description="Canadian French" language_id_desc="&fr_CA;" />
      <languageds language_id="-5" description="Canadian French" language_id_desc="&fr_CA;" />
      <languageds language_id="-6" description="Canadian French" language_id_desc="&fr_CA;" />
      <languageds language_id="-7" description="Canadian French" language_id_desc="&fr_CA;" />
      <languageds language_id="-8" description="Canadian French" language_id_desc="&fr_CA;" />
      <languageds language_id="-9" description="Canadian French" language_id_desc="&fr_CA;" />
      <languageds language_id="-10" description="Canadian French" language_id_desc="&fr_CA;" />
      <languageds language_id="-20" description="Canadian French" language_id_desc="&fr_CA;" /> 
      <languageds language_id="-21" description="Canadian French" language_id_desc="&fr_CA;" /> 
      <languageds language_id="-22" description="Canadian French" language_id_desc="&fr_CA;" /> 
      <languageds language_id="-23" description="Canadian French" language_id_desc="&fr_CA;" /> 
      <languageds language_id="-24" description="Canadian French" language_id_desc="&fr_CA;" /> 
      <languageds language_id="-25" description="Canadian French" language_id_desc="&fr_CA;" /> 
      
      
    7. Save this file.
  6. Create the remaining multi-language bootstrap files required for language support for the Canadian English language.
    1. Go to the following directory:
      • SolarisLinuxAIXWindowsWC_installdir\schema\xml\
      • WebSphere Commerce DeveloperWCDE_installdir\schema\xml\
    2. Locate the file wcs.bootstrap_multi_en_US.xml
    3. Make a copy of each file found in the previous step and rename it from wcs.bootstrap_multi_en_US.xml to wcs.bootstrap_multi_en_CA.xml.
    4. Open the file created in the previous step for editing; replace all references of en_US to en_CA.
    5. Save the file.
    6. Locate all the remaining files that start with wcs.bootstrap_multi_en_US_*.xml (excluding wcs.bootstrap_multi_en_US_base.xml).
    7. Make a copy of each file found in the previous step and rename it from wcs.bootstrap_multi_en_US_*.xml to wcs.bootstrap_multi_en_CA_*.xml. For example, rename the copy of wcs.bootstrap_multi_en_US_contract.xml to wcs.bootstrap_multi_en_CA_contract.xml.
    8. Open each of the files created in the previous step for editing; replace all references of &en_US; to &en_CA; (value used in language_id).
    9. Save all the files.
  7. Create the remaining multi-language bootstrap files required for language support for the Canadian French language.
    1. Go to the following directory:
      • SolarisLinuxAIXWindowsWC_installdir\schema\xml\
      • WebSphere Commerce DeveloperWCDE_installdir\schema\xml\
    2. Locate the file wcs.bootstrap_multi_fr_FR.xml
    3. Make a copy of each file found in the previous step and rename it from wcs.bootstrap_multi_fr_FR.xml to wcs.bootstrap_multi_fr_CA.xml.
    4. Open the file created in the previous step for editing; replace all references of fr_FR to fr_CA.
    5. Save the file.
    6. Locate all the remaining files that start with wcs.bootstrap_multi_fr_FR_*.xml (excluding wcs.bootstrap_multi_en_US_base.xml).
    7. Make a copy of each file found in the previous step and rename it from wcs.bootstrap_multi_fr_FR_*.xml to wcs.bootstrap_multi_fr_CA_*.xml. For example, rename the copy of wcs.bootstrap_multi_fr_FR_contract.xml to wcs.bootstrap_multi_fr_CA_contract.xml.
    8. Open each of the files created in the previous step for editing; replace all references of &fr_FR; to &fr_CA; (value used in language_id).
    9. Save all the files.
  8. Load the multilanguage bootstrap files to add the language support to WebSphere Commerce:
    1. Open a command prompt, browse to the directory where you extracted the included zip file.
    2. Run the script massload_en_CA.bat.
    3. Run the script massload_fr_CA.bat.
    After loading the new language bootstrap files into the database, WebSphere Commerce can include related multicultural data into the system.
  9. Feature Pack 7 or later Open the foundation component configuration file wc-component.xml in the directory Search_eardir/xml/config/com.ibm.commerce.foundation-ext. Add your locale to the Search EAR within the <_config:valuemappingservice> section of the file.
    For example:
    
    <_config:valuemapping externalName="Locale" internalName="langId">
       <_config:valuemap externalValue="locale" internalValue="internal_identifier"/>
    </_config:valuemapping>
    
    For more information, see Changing properties in the component configuration file (wc-component.xml) (Search EAR).
  10. Optional: If you are completing this tutorial on a staging server, add the language files and data to the WebSphere Commerce instance on your production server.

    After you complete this tutorial in a development environment, you need to add your language to your live production site. If you use a staging server, you should add the language to the WebSphere Commerce instance on your staging server and then propagate the data to your production server.

    1. Run the stagingprop utility on your staging server to propagate any staged records before your begin adding your data to your staging server.
      For more information about running this utility, see Stagingprop utility.
    2. Repeat the preceding steps (1-8) to add the language files and data to your staging server.
    3. Remove any records associated with your language setup from the STAGLOG database table.
    4. Repeat the preceding steps (1-8) on your production server to add the language files and data to that server.
    5. 4. Ran language setup tasks on runtime

Results

Your main bootstrap is updated and includes your new languages, and created new language specific bootstrap files to support the new languages. In the next step of the tutorial, you learn how to include the new languages in your WebSphere Commerce instance.