• 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: default language - do shell script - 10.2.8 problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: default language - do shell script - 10.2.8 problem


  • Subject: Re: default language - do shell script - 10.2.8 problem
  • From: Christopher Nebel <email@hidden>
  • Date: Tue, 15 Mar 2005 16:22:35 -0800

On Mar 15, 2005, at 11:03 AM, Armin Egginger [x] wrote:

Hi Scripters,

i use the shell script to get the default language of the system. Works fine in 10.3 but not in 10.2.8

my script:
set xTextLang to (do shell script "defaults read -g | grep AppleLanguages")
my script:
works fine in 10.3 - BUT NOT IN 10.2.8


the result in 10.3
" AppleLanguages = (en, ja, fr, es, it, nl, sv, no, da, fi, pt, \"zh_CN\", \"zh_TW\", ko); "
the result in 10.2.8 - without languages!
" AppleLanguages = ("


the result in the defaults in 10.3
AppleLanguages = (de, en, ja, fr, es, it, nl, sv, no, da, fi, pt, \"zh_CN\", \"zh_TW\", ko);
the result in the defaults in 10.2.8
there is a return between the languages like
AppleLanguages = (
de,
en,
ja,
fr,
es,
it,
nl,
sv, ....


Is it possible to get the content in 10.2.8 also? Any Tipp?

First, don't use defaults | grep if you can help it -- ask for the key you want:


    defaults read -g AppleLanguages
    --> (de, en, etc.)

From there, you can exploit the fact that AppleScript's "word" elements ignore punctuation:

    word 1 of (do shell script "defaults read -g AppleLanguages")
    --> "de"

I can't swear that this works on 10.2.8, since I don't have a system handy, but it should.


--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:
This email sent to email@hidden


References: 
 >default language - do shell script - 10.2.8 problem (From: "Armin Egginger [x]" <email@hidden>)

  • Prev by Date: Re: Address Book Scripts
  • Next by Date: Re: Serial i/o OSAX for OS X?
  • Previous by thread: default language - do shell script - 10.2.8 problem
  • Next by thread: Serial i/o OSAX for OS X?
  • Index(es):
    • Date
    • Thread