User Guide

GetLocaleDisplayName 619
<br>
<!--- Set the locale to the submitted value.
SetLocale returns the old ColdFusion locale name. --->
<cfset oldlocale=SetLocale("#form.mylocale#")>
<!--- Get the current locale's ColdFusion name.
It should have changed. --->
<cfset newlocale=GetLocale()>
New locale's ColdFusion name: #newlocale#<br>
New locale's display name in current locale: #GetLocaleDisplayName()#<br>
New locale's display name in old locale:
#GetLocaleDisplayName(newlocale, oldlocale)#<br>
New locale's display name in en_US:
#GetLocaleDisplayName(newlocale, "en_US")#<br>
<br>
Old locale's display name in current locale:
#GetLocaleDisplayName(oldlocale)#<br>
Old locale's display name in en_US:
#GetLocaleDisplayName(oldlocale, "en_US")#<br>
</cfif>
<!--- Self-submitting form to select the new locale. --->
<cfform>
<h3>Please select the new locale:</h3>
<cfselect name="mylocale">
<!--- The server.coldfusion.supportedlocales variable is a
list of all supported locale names. Use a list cfloop tag
to create an HTML option tag for each name in the list. --->
<cfloop index="i" list="#server.coldfusion.supportedlocales#">
<!--- In the select box, we use the US English display names for
the locales. You can change en_US to your prefered locale. --->
<option value="#i#">#GetLocaleDisplayName(i, "en_US")#</option>
</cfloop>
</cfselect><br>
<br>
<cfinput type="submit" name="submitit" value="Change Locale">
</cfform>
</cfoutput>
</body>
</html>