Localizing Currencies
On Web sites that support multiple languages, rendered pages must display currency values in the format appropriate for the language chosen by the user. Further, the price of any given product needs to be displayable in multiple currencies.
This topic contains:
Objects for Manipulating Currencies
Presenting Product Prices in Multiple Currencies
Other Currency Issues
Objects for Manipulating Currencies
Commerce Server provides several Component Object Model (COM) objects for processing currency values in different languages. These features include:
AppFrameWork Object. This object includes a method for retrieving locale-sensitive currency values from HTTP requests. This method is:
DataFunctions Object. This object includes several methods for converting and formatting currency values. These methods are:
DataFunctions.ConvertMoneyStringToNumber
DataFunctions.ConvertStringToCurrency
EuroDisplay Object. This object includes several methods for converting locale-sensitive currency strings to their equivalent numeric values, and back again. These methods are:
EuroDisplay.ConvertAltStringToCurr
For more information about these objects, see Display Objects.
Presenting Product Prices in Multiple Currencies
An issue related to the display of currencies in Web sites that support multiple languages is the presentation of product prices in different currencies.
As with product text, one alternative is to extend the product catalog schema to allow for the storage of product prices in different properties, one per language. The advantage of this approach is that product prices can be presented in conventional, well-rounded amounts such as $4.95 or £9.99. If you adopt this approach, however, you will be offering your products at slightly different prices based on the language chosen by the user, and you will have the burden of maintaining multiple prices per product.
A different strategy involves storing product-pricing information in only one currency, known as the reference currency. For example, you can store your prices in U.S. dollars or European euros, and then recalculate prices in other currencies dynamically, as needed. To calculate prices based on the reference currency, you need to create an exchange rate table that specifies the rates for other currencies in comparison to the reference currency. The exchange rate table should contain the following fields:
Currency symbol
International Standards Organization (ISO) currency code
Exchange rate
Display format
An example of an exchange rate table is shown below.
Currency symbol | ISO currency code | Exchange rate | Display format |
$ | USD (U.S. dollar) | 1.0 | ####.## |
£ | UKP (U.K. pound sterling) | 1.2 | ####.## |
F | BEF (Belgian franc) | 0.023 | ######,00 |
€ | EUR (European euro) | 0.9 | ####.## |
When your site displays a price, it calculates the price based on the exchange rate and displays it with the associated currency symbol and display format.
Important
- If you store search results and product detail pages in the CacheManager object, you must make the currency part of the cache key or you will retrieve the wrong results when you try to display pricing in a different currency.
Other Currency Issues
You may need to change the currency mode settings within the pipeline configurations to accommodate your choice of locale.