Enabling International Features for Solution Sites

The Solution Sites provide the foundation for implementing several features necessary for an international site, multiple languages, dual currency display, and multiple address formats. By default, none of these features are implemented in the Solution Sites. A full implementation of a truly international site is very complex and not suitable for the demonstration purposes of the Solution Sites.

Multiple languages for Solution Sites

Euro dual currency display for Solution Sites

Multiple address formats for Solution Sites

Localized data formats for Solution Sites

Initializing International features for Solution Sites

Multiple languages for Solution Sites

The solution sites are written for single language use. English, French, German and Japanese versions are available. But, they are written to simplify translation and provide the foundation for multiple language support. Most of the strings in the Solution Sites are contained in a single XML file, others, such as Site Terms, shipping method descriptions, and discount descriptions, come from external sources. Translating a site, not counting external strings, to another single language is simply a matter of translating the strings in the rc.xml file and changing the Language attributes in that file to the name of the new language. The first step in supporting multiple languages is also to edit the rc.xml file. Within the file there is a Language node with name and locale attributes for each supported language. An Entry node identifies each string in the application. Each Entry node contains a Value node for each language in the file. The Value nodes are distinguished by their Language attributes. For example:

   <Entry Name="L_Login_HTMLText" Type="General">
      <Value Language="English">Login</Value>

The MessageManager object serves as a repository for the text strings used on the Solution Sites. During application initialization the MessageManager object is loaded with the data in the rc.xml file. Whenever a string is needed in the Solution Sites it is retrieved from the MessageManager object with a call, such as sText = mscsMessageManager.GetMessage("L_FirstName_HTMLText", sLanguage). Throughout the Solution Sites the value of the sLanguage variable, used to determine the language used, is set to the value of the DefaultLanguage attribute in the rc.xml file. This limits the Solution Sites to a single language. In order to support multiple languages you will need to create a mechanism to select the correct value for the sLanguage variable as needed, perhaps based on the lcid.

Euro dual currency display for Solution Sites

The Solution Sites have the ability to enable dual-currency display for Euro-countries. The Commerce Server EuroDisplay object provides the foundation for displaying a price in two currencies simultaneously, for example the French Franc and the Euro. The exchange rate between the primary and secondary currencies is fixed at application initialization and comes from a value in the App Default Config settings. The htmRenderCurrency function renders currency values based on the value of the i_AltCurrencyOptions option in the App Default Config settings. This provides a centralized place for extending the currency display in the Solution Sites.

Multiple address formats for Solution Sites

There are commented examples in the Solution Sites that demonstrate changing the address format based on the default lcid for the site. Search the site for the string $$INTLADDR to find these examples.

Localized data formats for Solution Sites

The Solution Sites provide, through the Commerce Server DataFunction object, the ability to format and parse currencies and numbers in a variety of international formats. You can use this object to perform locale-based formatting, parsing, and value range checking of data on your site.

Initializing International Features for Solution Sites

Initialization for the international features occurs in the following files:

include\header.asp

include\txheader.asp

One or the other of these nearly identical files is included as the header in all of the pages in the Solution Sites applications. The header sets the character set for the page. By default this is set to the s_PageEncodingCharset option from the App Default Config settings.

If you need to explicitly set the server code page, for example you are running a Japanese site on an English server, use the CodePage directive. For more information about using multiple languages in Active Server Pages (ASP), search for "Accommodating International Clients" and "Setting the Code Page for String Conversions" on the Microsoft Developer Network (MSDN) at https://go.microsoft.com/fwlink/?LinkId=5161.

include\global_messagemanager_lib.asp

The Solution Sites use the MessageManager object to provide support for multiple languages. The GetMessageManagerObject function is called from the Main subroutine and the returned MessageManager object is set to Application scope as MSCSMessageManager. The data source for MSCSMessageManager is the rc.xml file.

include\global_internationalization_lib.asp

The InitAltCurrencyDisp function is called from the Main subroutine and the returned EuroDisplay object is set to Application scope as MSCSAltCurrencyDisp. The initialization values for the EuroDisplay object come from the App Default Config Settings.

include\global_data_lib.asp

The InitDataFunctions function is called from the Main subroutine and the returned DataFunctions object is set to Application scope as MSCSDataFunctions. The initialization value, Locale, for the DataFunctions object comes from the App Default Config settings.

See Also

App Default Config Settings for Solution Sites

Code to Manipulate and Display Euro Values

Localizing Web Site Text

DataFunctions Object

Copyright © 2005 Microsoft Corporation.
All rights reserved.