Re: Localize weekdays
Re: Localize weekdays
- Subject: Re: Localize weekdays
- From: Nigel Garvey <email@hidden>
- Date: Fri, 28 Jan 2005 20:28:33 +0000
Mr Tea wrote on Fri, 28 Jan 2005 13:44:37 +0000:
>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"
>
>--============================================
If he were to start from the actual date, this could be abbrieviated to:
set now to (current date)
set lwdls to {"lunes", "martes", "miércoles", "jueves", "viernes",
"sábado", "domingo"}
set i to (now - (date "Monday 6 January 1000 00:00:00")) mod weeks div
days + 1
set lwd to item i of lwdls
... obviously with "Monday 6 January 1000 00:00:00" rendered as "lunes, 6
enero 1000 00:00:00" to compile on jj's machine. :-)
>... 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.
It works on my 10.2.8 system. But the following from Emmanuel caught my
eye the other day. Maybe it's the Panther solution:
>set x to ""
>try
> set x to system attribute "LANG"
> if x = "" then set x to do shell script "defaults read -g AppleLocale"
>end try
>if x = "" then set x to "en"
It's the shell script that doesn't work on my machine.
NG
_______________________________________________
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