Re: reading a property list item
Re: reading a property list item
- Subject: Re: reading a property list item
- From: KOENIG Yvan <email@hidden>
- Date: Sun, 27 Jul 2008 18:36:39 +0200
Le 21 mai 2008 à 06:32, Mark J. Reed a écrit :
if I might suggest a Perly partial solution, this will get you a list
of month and day names in any POSIX locale installed on your system:
set pourLocale to "nl_NL"
set nomsDesMois to paragraphs of (do shell script "LC_TIME=" & quoted
form of pourLocale & " perl -MPOSIX -le 'for ($m=0;$m<12;++$m) { print
strftime(\"%B\", 0, 0, 12, 15, $m, 100) }' ")
set nomsDesJours to paragraphs of (do shell script "LC_TIME=" & quoted
form of pourLocale & " perl -MPOSIX -le 'for ($d=0;$d<7;++$d) { print
strftime(\"%A\", 0, 0, 12, $d, 0, 101) }' ")
This will get you a list of the available locale names:
set locales to paragraphs of (do shell script "locale -a")
although that includes some that differ only in character set; you
probably don't care about those differences, so this gets you a
shorter list of just the simple locale names:
set locales to paragraphs of (do shell script "locale -a | grep -v
'\\.'")
The names are all ab_XY where "ab" is the ISO 2-letter language code
and "XY" is the ISO 2-letter country code. es_ES is Spanish as she is
spoke in Spain; en_US is US English; fr_CA is Quebecois; etc.
Thank you Mark
Is it a clean way to force the date tool to use the locale strings?
I wish that
do shell script "date " & quote & "+%A %e %B %Y %H:%M:%S" & quote
(with some complementary code)
returns
"Dimanche 27 Juillet 2008 17:15:26"
and not
"Sunday 27 July 2008 17:15:26".
At this time, I uses this awful code:
set nDM to do shell script "date " & quote & "+%A %m" & quote
set nDay to word 1 of nDM
set nM to word 2 of nDM
set nameDays to {"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"}
repeat with i from 1 to count of nameDays
if nDay is item i of nameDays then exit repeat
end repeat
set pourLocale to "fr_FR"
set nomDuMois to (do shell script "LC_TIME=" & quoted form of
pourLocale & " perl -MPOSIX -le ' { print strftime(\"%B\", 0, 0, 12,
15," & nM - 1 & ", 100) }' ")
set nomDuJour to (do shell script "LC_TIME=" & quoted form of
pourLocale & " perl -MPOSIX -le ' {print strftime(\"%A\", 0, 0, 12, "
& i - 1 & ", 0, 101) }' ")
set finDate to do shell script "date " & quote & "+%e %B %Y %H:%M:%
SS" & quote
set ladate to nomDuJour & space & word 1 of finDate & space &
nomDuMois & text ((length of word 1 of finDate) + (length of word 2
of finDate) + 2) thru -2 of finDate
Yvan KOENIG (from FRANCE dimanche 27 juillet 2008 18:01:52)
_______________________________________________
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