It's a UDF (User Defined Function), you must be using CF5.

--- Ben


-----Original Message-----
From: Peter Tilbrook [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 13, 2001 7:24 PM
To: CF-Talk
Subject: RE: What is January in French? German? CF knows it already


I just get this:

Just in time compilation error

Invalid parser construct found on line 10 at position 10. ColdFusion was
looking at the following text:

LSMonthAsString
Invalid expression format. The usual cause is an error in the expression
structure.
The last successfully parsed CFML construct was a CFSCRIPT tag occupying
document position (9:1) to (9:10).

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Raymond
Camden
Sent: Thursday, 14 June, 2001 4:07 AM
To: CF-Talk
Subject: What is January in French? German? CF knows it already


I was having a conversation with Ben Forta about the UDF library project and
he suggested I add a function that would print the locale version of a
month. For example, the French (Standard) version of January. Well, I pinged
him back and said that as far as I know, I'd have to manually enter the
strings.

It turns out CF does this for you.

Check out the following example:

<CFSCRIPT>
function LSMonthAsString(month_number)
{
        VAR d=CreateDate(2000, month_number, 1);
        return LSDateFormat(d, "mmmm");
}
</CFSCRIPT>

<CFLOOP LIST="#Server.Coldfusion.SupportedLocales#" INDEX="locale"
DELIMITERS=",">
        <CFSET SetLocale(locale)>
        <CFOUTPUT>#locale#<BR></CFOUTPUT>
        <CFLOOP INDEX="X" FROM=1 TO=12>
                <CFOUTPUT>#LSMonthAsString(X)#<BR></CFOUTPUT>
        </CFLOOP>
        <P>
</CFLOOP>

This will loop through all the supported locales and return the name of each
month. Maybe this is something everyone knew about it but it sure surprised
the heck out of me. I knew CF had good locale functionality, but this rocks.

Anyway, thanks go to Ben Forta for the idea. I'm going to be modifying this
UDF and using it at www.cflib.org.

=======================================================================
Raymond Camden, Principal Spectra Compliance Engineer for Macromedia

Email   : [EMAIL PROTECTED]
ICQ UIN : 3679482

"My ally is the Force, and a powerful ally it is." - Yoda
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to