setLocale
Sets the country/language locale for CFML processing and the page returned to the client. The locale value determines the default format of date, time, number, and currency values, according to language and regional conventions.
setLocale(new_locale) → returns string
Argument Reference
new_locale string Required
The name of a locale; for example, "English (US)"
Values:
Chinese (China)Chinese (Hong Kong)Chinese (Taiwan)Dutch (Belgian)Dutch (Standard)English (Australian)English (Canadian)English (New Zealand)English (US)English (UK)French (Belgian)French (Canadian)French (Standard)French (Swiss)German (Austrian)German (Standard)German (Swiss)Italian (Standard)Italian (Swiss)JapaneseKoreanNorwegian (Bokmal)Norwegian (Nynorsk)Portuguese (Brazilian)Portuguese (Standard)Spanish (Modern)Spanish (Standard)Swedish
Examples Sample code invoking the setLocale function
Outputs the current locale, Sets the locale to French (Belgian) and outputs it, then puts it back to the original and outputs it
<cfscript>
currentLocale = getLocale();
writeOutput("Current: ");
writeDump(currentLocale);
writeOutput("<br />");
setLocale("French (Belgian)");
writeOutput("New: ");
writeDump(getLocale());
writeOutput("<br />");
setLocale(currentLocale);
writeOutput("Original: ");
writeDump(getLocale());
</cfscript>
© 2012–present Foundeo, Inc. and the CFDocs contributors.
Licensed under the MIT License.
ColdFusion is a trademark of Adobe Systems Incorporated.
https://cfdocs.org/setlocale