CFLib.org – Common Function Library Project

getLocaleInfo()

Last updated June 13, 2008

author

Reinhard Jung

Version: 1 | Requires: CF6 | Library: UtilityLib

Description:
This is a better version of getLocale. It allows you to get the full, long, and short version of the current locale.

Return Values:
Returns a struct.

Example:

<cfdump var="#getLocaleInfo()#">

Parameters:

No arguments.

Full UDF Source:

<!---
 A better version of getLocale.
 
 @return Returns a struct. 
 @author Reinhard Jung (reinhard.jung@gmail.com) 
 @version 1, June 13, 2008 
--->
<cffunction name="getLocaleInfo" description="gets the Locale" output="false">
    <cfset var myLocale = structNew() />
    <cfset var currentLocale    = CreateObject("java", "java.util.Locale").getDefault() />
    <cfset myLocale.short.country        = currentLocale.getCountry() />
    <cfset myLocale.short.language    = currentLocale.getLanguage() />
    <cfset myLocale.short                        = myLocale.short.language &'_' &myLocale.short.country />
    <cfset myLocale.long                        = getLocale() />
    <cfset myLocale.full                        = getLocaleDisplayName() />

    <cfreturn myLocale />
</cffunction>

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson