Re: Localize weekdays
Re: Localize weekdays
- Subject: Re: Localize weekdays
- From: Mr Tea <email@hidden>
- Date: Fri, 28 Jan 2005 13:44:37 +0000
This from jj - dated 27/1/05 11·26 pm:
> (current date) as text --> "viernes, 28 enero 2005 00:08:57"
> But I don't think I can pick "viernes" from this string, since I don't know
> if word-of-dateAsText-which-is-not-a-number is a weekday or a month name...
> I could try attempt to compile such thing, and it would work, unless the
> user doesn't like the weekday for his long-date-format and disables it in
> the International pref-pane. So, any idea?
It's often inconvenient for scripters (this one, at any rate) that the
result returned by 'current date' is governed by the formats set in system
preferences. Your task would be a lot easier if you could be sure that 'word
1 of ((current date) as text)' was always the weekday name in the local
language.
Is there a shell script that returns a localized weekday name? My modest
efforts in that area produced resolutely Anglocentric results, regardless of
the system language setting.
And this from Christian Vinaa - dated 28/1/05 9·52 am:
> Monday would be CVlu tuesday would be CVma
> (dont ask why)
So, not your initials and the first two letters of the weekday name in
French , then? :-)
Your suggestion that JJ can get the 'weekday' constant and translate it to a
localized string using a couple of lists would certainly work. For a Spanish
localization it might look like this:
--============================================
set wd to weekday of (current date)
set wdls to {Monday, Tuesday, Wednesday, Thursday, Friday, Saturday,
Sunday}
set lwdls to {"lunes", "martes", "miércoles", "jueves", "viernes",
"sábado", "domingo"}
repeat with i from 1 to 7
if wd is item i of wdls then
set lwd to item i of lwdls
exit repeat
end if
end repeat
lwd --> "viernes"
--============================================
(Any lines that abut the left margin of the message window have been wrapped
and should be re-connected to the end of the previous line.)
Things start to get complicated if the script needs to work in a variety of
languages. It would be simple enough (if rather dull) to build a library or
master-list containing names of weekdays in a rainbow of tongues, but once
you've done that how do you find out the language that the user's system is
set to? I was under the impression that there was a "LANG" system attribute
that might provide this information, but there seems to be no such thing OMM
when I ask for it with AppleScript. (OS X 10.3.7) Surely this information
must be script-accessible somehow.
Nick
pp Mr Tea
--
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden