Develop > Controller layer > Application developer > Support globalization > Program models for globalized stores
Create a new display format
To create a new display format:
Procedure
- 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.
- Run the following command:
insert into language (LANGUAGE_ID, ENCODING, LOCALENAME, LANGUAGE, COUNTRY) values (ID_Value, ENCODING_VALUE, 'x', 'y', 'z')Where:
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.
- 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 the 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 localename 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.
- Add an entry to the LANGUAGEDS table. For an example, refer to Example of creating a new display format.
- Add an entry to the LANGPAIR table. For an example, refer to Example of creating a new display format.
- Add the language to the store. The WCS instance must support this new language or we will also need to add the language to the WCS instance in Configuration Manager. Refer to the SupportedLanguages element in the WebSphere Commerce configuration file.
Results
You may need to add multiple entries to the LANGUAGEDS and LANGPAIR tables, one for every language that the 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.
- Translate the storetext_locale.properties file to Thai.
- Verify the encoding statement in the properties file references a character set that target browsers will support. For Thai the encode statement is... ENCODESTATEMENT = text/html; charset=MS874
- Save the file as storetext_th_TH.properties
- Open a database command window and run the following command:
select * from languageThis 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.
- 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>')
- 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.
- 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.
- 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.propertiesWhere JDK_dir is the path to your JDK
Copy the storetext_th_TH_new.properties file from the temporary directory to WC_EAR/Stores.war/WEB-INF/classes/ storeDir/storetext_th_TH.properties.
Related concepts
Program models for globalized stores
Related tasks
Use resource bundles in store pages
Related reference
massload utility (Server environment)