Contents > Developing ColdFusion MX Applications > Developing Globalized Applications > Locales > Using the locale PreviousNext

Using the locale

The SetLocale function determines the default formats that ColdFusion uses to output date, time, number, and currency values. ColdFusion MX supports 26 locales. For the complete list, see CFML Reference. You use the GetLocale function to determine the current locale setting of ColdFusion MX. If you have not made a call to SetLocale, GetLocale returns the locale of the JVM.

The current locale has two effects:

Note: Prior to ColdFusion MX, the default locale was always English, not the operating system's locale. For the Japanese version of ColdFusion, the default was Japanese.

The following example uses the LSCurrencyFormat function to output the value 100,000 in monetary units for all the ColdFusion-supported locales. You can run this code to see how the locale affects the data returned to a browser.

<p>LSCurrencyFormat returns a currency value using the locale convention. 
<!--- loop through list of locales; show currency values for 100,000 units --->
<cfloop LIST = "#Server.Coldfusion.SupportedLocales#"
index = "locale" delimiters = ","> <cfset oldlocale = SetLocale(locale)> <cfoutput><p><b><I>#locale#</I></b><br> Local: #LSCurrencyFormat(100000, "local")#<br> International: #LSCurrencyFormat(100000, "international")#<br> None: #LSCurrencyFormat(100000, "none")#<br> <hr noshade> </cfoutput> </cfloop>

This example uses the ColdFusion variable Server.Coldfusion.SupportedLocales, which contains a list of all supported ColdFusion locales.


Contents > Developing ColdFusion MX Applications > Developing Globalized Applications > Locales > Using the locale PreviousNext

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/i18n12.htm