Creating a new display format

To create a new display format:

Procedure

  1. Run the following command:
    
    select * from language
    
    This command returns the language IDs in use by currently available display formats. Choose the next available ID_VALUE.
  2. Run the following command:
    
    insert into language (LANGUAGE_ID, ENCODING,
    LOCALENAME, LANGUAGE, COUNTRY) values (ID_Value, ENCODING_VALUE,
    'x', 'y',
    'z')
    
    Where:
    ID_VALUE
    The value you selected in step 2.
    LANGUAGE_ID
    Required: An identifier to uniquely identify the display format.
    ENCODING_VALUE
    Required: The character encoding value that the browser should use to display the page for this language. This should be the same encoding value used in your property files. ENCODESTATEMENT = text/html; charset=[ENCODING_VALUE]. A list of encoding values supported by the Sun JDK is available from the Sun Java site at www.java.sun.com.
    LOCALENAME
    Required: A Java locale used to represent a political, geographical, or cultural region that has a distinct language and customs for formatting. The locale name is the two-letter ISO 639 language code, followed by the two-letter ISO 3166 country code, separated by an underscore.
    LANGUAGE Optional:
    The name of the language.
    COUNTRY Optional:
    The country or region for the display format.
    VARIANT Optional:
    The variant column is an extra column that allows you to describe a subgroup within a particular culture, such as teen, technical, other any other classification.
    For example, to add a display format for Italian as spoken in the United States, you could execute the statement: insert into language (LANGUAGE_ID, ENCODING, LOCALENAME, LANGUAGE, COUNTRY) values ('333', 'ISO8859-1', 'it_US', 'Italian', 'United States') You may also want to specify an alternative language, refer to Example of creating a new display format.
  3. Add an entry to the LANGUAGEDS table. For an example, refer to Example of creating a new display format.
  4. Add an entry to the LANGPAIR table. For an example, refer to Example of creating a new display format.
  5. Add the language to the store.

Results

Note: You may need to add multiple entries to the LANGUAGEDS and LANGPAIR tables, one for every language that your store supports.

Example of creating a new display format

The following example shows how you could create a display format to view the ConsumerDirect starter store pages in Thai.

  1. Translate the storetext_locale.properties file to Thai.
  2. Ensure that the encoding statement in the properties file references a character set that target browsers will support. For Thai the encode statement is as follows: ENCODESTATEMENT = text/html; charset=MS874
  3. Save the file as storetext_th_TH.properties
  4. Open a database command window and run the following command:
    
    select * from language
    
    This command returns the language IDs in use by currently available display formats. Choose the next available ID_VALUE. In this example, the ID_VALUE is for Thai is 3.
  5. Run the following command:
    
    insert into language (LANGUAGE_ID, ENCODING,
    LOCALENAME, LANGUAGE, COUNTRY, MIMECHARSET)  values (ID_Value,
    ENCODING_VALUE,
    'w', 'x', 'y', 'z')
    
    Using the following values:
    
    insert into language (LANGUAGE_ID,
    ENCODING, LOCALENAME, LANGUAGE, COUNTRY) values ('3', 'MS874',
    'th_TH', 'Thai',
    'Thailand','<MIME character>')
    
  6. Add an entry to the LANGUAGEDS table with the following values:
    insert into  languageds (LANGUAGE_ID, 
    DESCRIPTION, LANGUAGE_ID_DESC) values (ID_Value,'x', ID_Desc_Value)
    Using the following values:
    insert into  languageds (LANGUAGE_ID, 
    DESCRIPTION, LANGUAGE_ID_DESC) values (-1, 'French', 2)

    See, step 2 for more information about the values.

  7. Create an alternative language for Thai used if the data requested in Thai does not exist. This is useful if not all the data in the database is translated into the new language. To create an alternative language run the following command:
    
    insert into langpair(LANGUAGE_ID, LANGUAGE_ID_ALT, SEQUENCE,
    STOREENT_ID)  values (ID_Value, ID_Value_ALT, 'x', 'y') 
    
    Using the following values:
    
    insert into langpair(LANGUAGE_ID, LANGUAGE_ID_ALT, SEQUENCE ,
    STOREENT_ID)
    values ('3','-1', '1' '12345')
    
    where
    LANGUAGE_ID
    The requested language
    LANGUAGE_ID_ALT
    is the alternative language
    SEQUENCE
    When the requested Language is supported as specified in the STORELANG table, but information is not available in that Language, each alternative Language is tried in ascending order of SEQUENCE. A store may override the SEQUENCE specified for its StoreGroup.
    STOREENT_ID
    The StoreEntity this relationship belongs to The alternative Language relationships for a Store include the alternative Language relationships for its StoreGroup.

    The preceding insert statement will assign English (language id = -1) as the first alternative language to try for store with id '12345' in the event that no Thai data is found.

  8. Convert any properties file from native to ASCII: Copy the storetext_th_TH.properties file to a temporary directory (for example, /tmp). Run the following command:
    
    JDK_dir/bin/native2ascii -encoding TIS620
    /tmp/storetext_th_TH.properties
    /tmp/storetext_th_TH_new.properties
    
    Where JDK_dir is the path to your JDK

    Copy the storetext_th_TH_new.properties file from the temporary directory to workspace_dir/Stores.war/WEB-INF/classes/ storeDir/storetext_th_TH.properties.