SetLocale

Sets the current request-level locale.

Method Signature

SetLocale(locale=[string])

Arguments

Argument
Type
Required
Description
Default

locale

string

true

The locale ISO directive, common name or alias

Examples

Set Locale Script Example

Outputs the current locale, Sets the locale to French (Belgian) and outputs it, then puts it back to the original and outputs it

<bx:script>
	currentLocale = getLocale();
	writeOutput( "Current: " );
	writeDump( currentLocale );
	writeOutput( "<br />" );
	setLocale( "French (Belgian)" );
	writeOutput( "New: " );
	writeDump( getLocale() );
	writeOutput( "<br />" );
	setLocale( currentLocale );
	writeOutput( "Original: " );
	writeDump( getLocale() );
</bx:script>

Additional Examples

dump( getLocale() );
setLocale( "english (australian)" );
dump( getLocale() );
dump( Server.BOXLANG.SUPPORTEDLOCALES.listToArray().sort( "text" ) );

Last updated

Was this helpful?