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>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson