• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: reading a property list item
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: reading a property list item
      • From: Axel Luttgens <email@hidden>
  • Prev by Date: Re: Computer Serial Number
  • Next by Date: osascript and text output
  • Previous by thread: Re: slash path to alias
  • Next by thread: Re: reading a property list item
  • Index(es):
    • Date
    • Thread