Re: Month Names
Re: Month Names
- Subject: Re: Month Names
- From: Christopher Nebel <email@hidden>
- Date: Tue, 10 Nov 2009 10:22:32 -0800
On Nov 10, 2009, at 10:08 AM, Luther Fuller wrote:
>>>> month of (current date) --> November
>>
>> The month returned by that command is a constant, not a text string. It’s
>> part of the appleScript language, which is no longer localized.
>>
>> But, you can coerce the value to text which should be localized:
>>
>> month of (current date) as text
>
> Tried it. But it does not translate. In German, '... as text' returns "November".
> I'm thinking that English month names are standard. (?)
Sort of. Ed is correct in that the initial result is an enumerator, not text, and is therefore never localized. Coercing it to text uses the normal enumeration-to-text coercion, which simply gives you the name of the enumeration as text, so it stays in English. There is no totally reliable way in pure AppleScript to get the localized month name. However, you can fake it for particular locales by tearing apart date strings; you can use 'do shell script "date +%B"' if your LANG is set properly; and if you're using AppleScriptObjC, you can use CFDateFormatter.
--Chris Nebel
AppleScript Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden