Develop > Controller layer > Application developer
Support globalization
The WebSphere Commerce architecture is designed to support globalization. Globalization is the proper design and execution of systems, software, services, and procedures so that one instance of software, executing on a single server or end-user machine, can process multilingual data and present culturally correct data in a multicultural environment such as the Internet.
WebSphere Commerce is translated to the following thirteen languages:
- United States English
- French
- German
- Italian
- Spanish
- Brazilian Portuguese
- Simplified Chinese
- Traditional Chinese
- Korean
- Japanese
- Russian
- Romanian
- Polish
This includes the software, documentation, user interfaces, and the samples. You can add support for other languages. You can translate many of the features of the site, such as product descriptions, messages, and text on the pages. This applies to pages on the store as well as on the browser based WebSphere Commerce tools, such as the WebSphere Commerce Accelerator and the Administration Console.
WebSphere Commerce includes several features that allow you to create a site that can be tailored to fit the needs of an international or culturally diverse customer base. Using Java technology and a flexible database schema, some of the cultural characteristics of the site that can vary depending on location or customer preference are:
- Language
- A store may be viewed in more than one language. For example, you might want to allow users to choose the language in which they would like to view the site, or you may want to automatically select a default language, which is the store's default language.
- Currency
- A store may display prices in more than one currency. In WebSphere Commerce, the selection of a specific currency is not related to the selection of a particular language.
- Cultural format
- Data may be displayed in various customizable formats. Customers from different cultures may have different expectations about how certain information should be displayed. For example, a decimal number may be indicated by using either a comma or a period, depending on the language, country, or region of the customer.
- Address
- Addresses may be entered, stored, and displayed in various formats, to conform to different international standards.
- Taxation
- Taxation rules may be defined for different jurisdictions. This includes rules for sales and other business taxes.
- Ship
- Ship rules and carriers may be defined for different jurisdictions.
- Payment method
- Payment methods may be defined for different jurisdictions.
- Prices
- The price can be set in one currency and a conversion factor can convert from this currency to other currencies, or the price can be set per currency.
- Online catalog content
- Product and category descriptions, attributes, and images may be varied across locations. WebSphere Commerce allows a merchant to manage online catalog content for selectable display format by defining each format within the language table. You can also maintain a master product catalog that can be shared by a number of stores.
The WebSphere Commerce database allows you the flexibility to create and maintain internationally recognizable data by using Unicode UTF-8 encoding, or UCS-2, which can be converted into most international encoding formats when sent to a Web browser. For a working sample of a site globalized for many countries, see any of the starter stores.
The Administration Console and WebSphere Commerce Accelerator support globalized usage. These tools display in any of the thirteen national languages that WebSphere Commerce supports, however, you might need to maximize the WebSphere Commerce Accelerator window to view menu items which are otherwise truncated. The Administration Console and WebSphere Commerce Accelerator use a programming model that allows for additional languages to be added without affecting the general functioning or look-and-feel of the pages.
You can translate the WebSphere Commerce tools into other languages, just as you would translate a store or a Web site.
To translate the tools modify the appropriate properties files located under the following directory:
- WC_EAR/properties/com/ibm/commerce/tools/
- workspace_dir\stores\properties\com\ibm\commerce\tools\
If you do not want to restart WebSphere Application Server every time a properties file is changed, then do the following:
- Open the WebSphere Commerce configuration file.
- Change the value of developmentMode to "true". The default value is "false".
- Restart WebSphere Application Server
Starter stores
The starter stores and sites provide a foundation to create the store. All the starter stores demonstrate how you can create and maintain a globalized site.
The starter stores allow customers to select the language in which they would like to view the site. In ConsumerDirect and Commerce Plaza, you select the desired display format from a list. The list is displayed in a drop-down list on the left frame throughout the site. Customers can navigate through the site, viewing it in the language of their choice.
In AdvancedB2BDirect, you switch languages from the personal information page to select the preferred language.
In ConsumerDirect, you can switch the language on the logon page of the site. Customers can also select a preferred language in the personal information page.
In Commerce Supplier Hub, a drop-down list on the logon page allows you select the language.
The starter stores use the single template for all stores and languages programming model. Each supported language has its own property file, which contains the translated text and messages for that language. All store archives contain: publishNLS.properties and publishNLS_en_US.properties. These are used in the publish wizard.
_ locale represents all the supported locales of the store.
For ConsumerDirect:
- Address_ locale.properties (Used to define the mandatory fields for the address add and update commands. Contains control information for each locale and no translatable text.)
- AddressText_ locale.properties (Not used empty.)
- storeErrorMessages_ locale.properties (Defines the error messages for each error code for this store.)
- storetext_ locale.properties (Used to store all storefront text and messages.)
- storetext_dynamic_ locale.properties (Used by both change pages UI in WebSphere Commerce Accelerator and storefront to display dynamic text.)
- storetext_dynamic_labels_ locale.properties (Used by change pages UI in WebSphere Commerce Accelerator.)
- UserRegistration_ locale.properties (Used to define the mandatory fields for the user registration add and update commands. Contains control information for each locale and no translatable text.)
- UserRegistrationText_ locale.properties (Defines the options for certain registration fields.)
For AdvancedB2BDirect:
- Address_ locale.properties (Used to define the mandatory fields for the address add and update commands.)
- AddressText_ locale.properties (Not used empty.)
- OrgEntity_ locale.properties (Used to define the mandatory fields for the organization registration add and update commands.)
- OrgEntityText_ locale.properties (Defines the options for certain organization registration fields.)
- storeErrorMessages_ locale.properties (Defines the error messages for each error code for this store.)
- tooltechtext_ locale.properties (Used to store all storefront text and messages.)
- tooltechtext_dynamic_ locale.properties (Used by both change pages UI in WebSphere Commerce Accelerator and storefront to display dynamic text.)
- tooltechtext_dynamic_labels_ locale.properties (Used by change pages UI in WebSphere Commerce Accelerator.)
- UserRegistration_ locale.properties (Used to define the mandatory fields for the user registration add and update commands.)
- UserRegistrationText_ locale.properties (Defines the options for certain registration fields.)
- UserRegistrationB2B_ locale.properties (Used to define the mandatory fields for the B2B user registration add and update commands.)
- UserRegistrationB2BText_ locale.properties (Defines the options for certain B2B registration fields)
For Extended Sites Hub (Extended Sites business model store):
- Address_ locale.properties (Used to define the mandatory fields for the address add and update commands.)
- AddressText_ locale.properties (Not used empty.)
- OrgEntity_ locale.properties (Used to define the mandatory fields for the organization registration add and update commands.)
- OrgEntityText_ locale.properties (Defines the options for certain organization registration fields.)
- b2cHostingChannel_ locale.properties (Used to store all storefront text and messages.)
- UserRegistration_ locale.properties (Used to define the mandatory fields for the user registration add and update commands.)
- UserRegistrationText_ locale.properties (Defines the options for certain registration fields.)
- UserRegistrationB2B_ locale.properties (Used to define the mandatory fields for the B2B user registration add and update commands.)
- UserRegistrationB2BText_ locale.properties (Defines the options for certain B2B registration fields.)
For StoreDirectory (Extended Sites business model store):
- b2cHostingPublic_ locale.properties (Used to store all storefront text and messages.)
For CommercePlaza (DemandChain business model store):
- OrgEntity_ locale.properties (Used to define the mandatory fields for the organization registration add and update commands.)
- OrgEntityText_ locale.properties (Defines the options for certain organization registration fields.)
- pcdmarket_ locale.properties (Used to store all storefront text and messages.)
- UserRegistration_ locale.properties (Used to define the mandatory fields for the user registration add and update commands.)
- UserRegistrationText_ locale.properties (Defines the options for certain registration fields.)
- UserRegistrationB2B_ locale.properties (Used to define the mandatory fields for the B2B user registration add and update commands.)
- UserRegistrationB2BText_ locale.properties (Defines the options for certain B2B registration fields.)
For SupplierMarketplace (SupplyChain business model store):
- Address_ locale.properties (Used to define the mandatory fields for the address add and update commands.)
- AddressText_ locale.properties (Not used empty.)
- AuctionMessageText_ locale.properties (Defines auction pages messages and text.)
- OrgEntity_ locale.properties (Used to define the mandatory fields for the organization registration add and update commands.)
- OrgEntityText_ locale.properties (Defines the options for certain organization registration fields.)
- storeErrorMessages_ locale.properties (Defines the error messages for each error code for this store.)
- tooltechtext_ locale.properties (Used to store all storefront text and messages.)
- tooltechtext_dynamic_ locale.properties (Used by both change pages UI in WebSphere Commerce Accelerator and storefront to display dynamic text.)
- tooltechtext_dynamic_labels_ locale.properties (Used by change pages UI in WebSphere Commerce Accelerator.)
- UserRegistration_ locale.properties (Used to define the mandatory fields for the user registration add and update commands.)
- UserRegistrationText_ locale.properties (Defines the options for certain registration fields.)
- UserRegistrationB2B_ locale.properties (Used to define the mandatory fields for the B2B user registration add and update commands.)
- UserRegistrationB2BText_ locale.properties (Defines the options for certain B2B registration fields.)
Within the property file, a number of elements of the page are translated:
- Text
- Textual page content.
- Labels
- Form field labels.
- Messages
- Error, status, and confirmation messages.
- Alternate text
- For images, Java applets, and other embedded objects.
- Resource bundles
- From the command context, the locale is used to retrieve the storetext Properties java object, which obtains its values from the storetext_locale.properties file in the appropriate locale specific directory. The template then has access to each of the properties as needed, through the use of the getString() method of the ResourceBundle object.
- Determine the character set
- The character set in which the text is displayed in a browser is defined in the property file using the ENCODESTATEMENT property. For example, the storetext_en_US.properties file contains the statement:
ENCODESTATEMENT = text/html; charset=ISO_8859-1
- Because encoding is specified within the property file instead of in the JSP template, the character set can be different for each language. The default character encoding for the WebSphere Application server is located in:
- WAS_HOME\bin\wsinstance\propdefaults\encoding.properties
The character-encoding of the generated JSP page is set using the following statement in the JSP template:
<%response.setContentType(storetext.getString("ENCODESTATEMENT"));%>
for JTSL:
<c:set property="contentType" target="${pageContext.response}"> <fmt:message key="ENCODESTATEMENT" bundle="${storeText}" /> </c:set>
When setLocal is called using:
(<fmt:setLocale value="${CommandContext.locale}" />)the default character encoding is selected from the WebSphere Application server. JSTL takes the last set of character encoding as the returned encoding that will be sent to the Web browser. in most cases people won't have problem with this. they only get into trouble when dealing with BiDi languages where they can have multiple ISO character encodings per locale.
At run time, each requested JavaServer Page includes the EnvironmentSetup.jsp or EnvironmentSetup.jspf file. The command context is retrieved from this file.
Note: This is for stores created with the Store Creation Wizard only. When a seller creates a store, this is not a regular store publish, and additional store language assets beyond the store default language are not carried over into the store. So, if a seller adds a supported language to a store, the store assets for that language are not available. If a supported language is going to be added to a store, ensure that the translated assets (properties files) are available to the store or the store pages will not function correctly.
- Display translated images
The locale and language are retrieved at run time to determine the correct folder in which to look for the image file. The template may look for the file ConsumerDirect\ language_Locale\images\go_button.gif , where language_Locale is replaced by the display format from the command context. For example, the resulting page will display the image: ConsumerDirect\en_US\images\colors\color1\go_button.gif.
- Display catalog content
- The catalog contains multiple translations, one for each supported locale. At run time, the command context is sent through a data bean to determine which translation to retrieve from the database and display on the page.
- Resource bundles and property files
Resource bundles and property files allow you to maintain collections of java objects that are locale-specific for the JavaServer Pages. When the page needs a locale-specific resource, such as a form field label, a graphical user interface message, or a value for a drop-down menu, the page can load it from the resource bundle or property file that is appropriate for the selected locale, allowing the customer to view the page in their own language. In this way, you can create JSP templates that are largely independent of the customer's locale, isolating all of the locale-specific information in the resource bundles or property files.
Although resource bundles and property files perform similar functions, there are some differences in the manner in which they are processed. The following table shows some of the important differences between resource bundles and property files:
Property files ListResource bundles Text files Compiled format Slight performance degradation Slight performance boost If a property file is changed, WebSphere Application Server must be restarted to see the changes. If a resource bundle is changed, it must be recompiled and WebSphere Application Server must be restarted to see the changes. Language and locale dependent. One file should exist for each locale. You need to run native2ascii on non-ISO-8859-1 characters. Language and locale dependent. One file should exist for each locale. You need to run native2ascii on non-ISO-8859-1 characters.
For an example of how property files can be used in a site globalized for many countries, refer to the starter stores. For more information about these topics, visit the Sun Microsystems Java Web site.
Data storage and transfer
A single store can display pages in multiple languages, even when the languages use different character sets.
To accomplish this, data is stored in the WebSphere Commerce database in a universal format that can be applied to a wide number of languages. Since not all Web browsers support the same character sets, when the data is requested by a JavaServer Page, it is converted into an appropriate character set.
The following is a description of how data travels from the database to the browser:
- Text data is stored in the WebSphere Commerce database using Unicode UTF-8 encoding or UCS-2.
- JDBC drivers load the data from the database, converting it from UTF-8 to Java's native 16-bit Unicode encoding.
- The JSP files output the data using the Java 16-bit encoding.
- The WebSphere Application Server converts the JSP file output from 16-bit Unicode to the target encoding. The encoding can either be specified in the JSP file or in a property file. For example, to specify Shift-JIS encoding for a Japanese page:
- JSP file <%@ page contentType="text/html; charset=Shift-JIS"%>.
- Property file ENCODESTATEMENT = text/html; charset=Shift-JIS The character-encoding of the generated JSP file is set using the following statement in the JSP template: <%response.setContentType(fashionflowtext.getString ("ENCODESTATEMENT")); %>
- JSTL: <c:set property="contentType" target="${pageContext.response}"> <fmt:message key="ENCODESTATEMENT" bundle="${storeText}" /> </c:set>
Since not all browsers can understand every encoding scheme, it is recommended that you specify the more well known encoding schemes, such as UTF-8 and Shift-JIS.
- The converted data is sent back to the browser.
- The browser interprets the HTTP reply based on the encoding specified in the header.
The following describes how data travels from the browser to the database:
- Data is entered in the browser. Multilingual data can be entered using an input method editor.
- WebSphere Commerce converts the data coming from the browser into Java 16-bit encoding using the setCharacterEncoding() method. Each LANGUAGE_ID in the LANGUAGE table is mapped to an encoding value using the ENCODING column. This value is used to interpret the data coming from the browser.
- The data is sent to the database where it is converted from Java 16-bit to UTF-8 encoding, which is how it is stored in the database as shown in the following diagram:
Multilingual data entry
If the browser supports Unicode, then you can display multiple languages simultaneously in a browser. However, the operating system may not have the characters enter text in some languages.
To do this, you may need to use an input method editor. An input method editor is a software component that converts key presses into text input which cannot be typed directly. Input method editors are normally used to input text for languages which have more characters than can fit on a standard keyboard, such as Japanese, Chinese and Korean, Thai and Hindi. A common input method editor tool is Microsoft Global Input Method Editor (IME) which is available from the Microsoft Web site. The Global IME is appropriate for both customers to enter data on shopping pages, and for administrators to enter data in the WebSphere Commerce Accelerator and the Administration Console.
If you choose not to use an input method editor, you can also enter data in different languages provided that you have a number of machines setup, each using a different operating system language with a suitably configured browser. A browser automatically supports the language that is native to the machine on which it is installed. For example, to enter Japanese and German data, you can setup two machines, one using a German operating system and one using a Japanese operating system, each with a browser capable of displaying data from that operating system. For more information, consult the documentation for the operating system or Web browser.
Unicode
WebSphere Commerce text data is encoded using the Unicode character set. Unicode can display characters used in all major languages, including European, Middle Eastern and Asian languages. In WebSphere Commerce, the Unicode UTF-8 standard is used to store data in multiple languages in the same database instance. Although customers do not need to have a Unicode-enabled browser to view sites driven by WebSphere Commerce, administrators may need one if they want to view their site in more than one language on the same machine.
To view the site in a language other than English, you need a Unicode enabled browser. For more information about Unicode, visit the Unicode Web site.
Display formats
Display formats allow a single store to sell to a globalized, multilingual customer base. Each display format can be identified by three factors: a language, a region, and a variant you can define. You can design the site to display different content to groups that differ on any of these factors. For example, you could use language and locale to have a separate format for US English and Canadian English. These display formats can have the same text, but different currencies and units of measurement. You can add a display format for Canadian French. This display format could display the same currency and units of measurement as Canadian English, though the text will be in Canadian French. You could even use the third factor to have a separate format for specific audiences within a culture, such as teens, scientists, or technical professionals, tailoring the site to suit their expectations.
Customers can either choose the format in which they want to view the site, or you can set a default value for them. Information regarding the format is passed through a URL parameter when to change the language. For example, if you pass in langId=-2, the session sets the current language to French. The langId is stored in the session. When the customer requests a page the display format determines the Web assets and catalog information to retrieve.
Related concepts
WebSphere Commerce configuration file
Program models for globalized stores
Related tasks
Related reference
massload utility (Server environment)