Creating a new display format
To create a new display format:
Procedure
-
Run the following command:
This command returns the language IDs in use by currently available display formats. Choose the next available ID_VALUE.select * from language
-
Run the following command:
Where:insert into language (LANGUAGE_ID, ENCODING, LOCALENAME, LANGUAGE, COUNTRY) values (ID_Value, ENCODING_VALUE, 'x', 'y', 'z')
- 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.
- 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.
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.
- Translate the storetext_locale.properties file to Thai.
- 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
- Save the file as storetext_th_TH.properties
- Open a database command window and run the following command:
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.select * from language
- Run the following command:
Using the following values:insert into language (LANGUAGE_ID, ENCODING, LOCALENAME, LANGUAGE, COUNTRY, MIMECHARSET) values (ID_Value, ENCODING_VALUE, 'w', 'x', 'y', 'z')
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:
Using the following values:insert into languageds (LANGUAGE_ID, DESCRIPTION, LANGUAGE_ID_DESC) values (ID_Value,'x', ID_Desc_Value)
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:
Using the following values:insert into langpair(LANGUAGE_ID, LANGUAGE_ID_ALT, SEQUENCE, STOREENT_ID) values (ID_Value, ID_Value_ALT, 'x', 'y')
whereinsert into langpair(LANGUAGE_ID, LANGUAGE_ID_ALT, SEQUENCE , STOREENT_ID) values ('3','-1', '1' '12345')
- 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:
Where JDK_dir is the path to your JDKJDK_dir/bin/native2ascii -encoding TIS620 /tmp/storetext_th_TH.properties /tmp/storetext_th_TH_new.properties
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.