• 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: Getting the default language with AppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting the default language with AppleScript


  • Subject: Re: Getting the default language with AppleScript
  • From: Paul Berkowitz <email@hidden>
  • Date: Fri, 23 Jul 2004 20:10:46 -0700

A couple of weeks ago we worked out that in Panther, you can get the user's
default language (formerly 'system attribute "LANG"' in Jaguar and earlier)
by

do shell script "defaults read -g AppleLocale"

(or rather the bit before the "_" if it has a "_").

But now I've discovered that a friend, also in OS 10.3.4 like I am, has no
global AppleLocale default entry at all, and that command errors:

"The domain/default pair of (kCFPreferencesAnyApplication, AppleLocale)
does not exist."

I had him do a

defaults read -g

both via AppleScript and in the Terminal (different shells), and the very
long list of defaults contained no AppleLocale.

I had him check System Preferences/International/Formats and his is set to
"United States". (Even when I changed mine to "Custom", logged out and in,
I still got "en_US" for mine.) He has BSD installed normally.

Does anyone know what condition results in an AppleLocale, and what doesn't?
And if one can make any deduction as to locale if one doesn't have a
globalDomain AppleLocale?


Paul Berkowitz



On 7/7/04 9:13 AM, "Paul Berkowitz" <email@hidden> wrote:

>> At 9:27 AM -0400 06/07/04, Alexandre Koff wrote:
>>> I was just wondering if anyone knows how to get the user's default
>>> language using AppleScript. I was reading through the AppleScript
>>> documentation on developer.apple.com but it seems to be a bit lacking.
>>
>> Sorry if this has been said already, but I use:
>>
>> -------------
>> system attribute "LANG"
>
> That works in Jaguar (where I used to use it myself, as I said earlier) but
> not in Panther, where all this has been changed utterly.
>
> system attribute "LANG" -- in OS 10.3.4
> --> ""
>
> So it's just a matter of doing a 'system attribute "sysv"' first.
>
> The same thing can be done in plain AppleScript using:
>
> set AppleScript's text item delimiters to {"_"}
> if (system attribute "sysv") < 4144 then
> set lang to text item 1 of (system attribute "LANG")
> else
> set lang to text item 1 of (do shell script "defaults read -g
> AppleLocale")
> end if
> set AppleScript's text item delimiters to {""}
> lang
> -- "en" -- here


--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Getting the default language with AppleScript
      • From: LuKreme <email@hidden>
    • Re: Getting the default language with AppleScript
      • From: Paul Skinner <email@hidden>
References: 
 >Re: Getting the default language with AppleScript (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Re: "do shell" vs. Plain old AppleScript nomenclature
  • Next by Date: Re: Problem getting position of desktop items
  • Previous by thread: Re: Getting the default language with AppleScript
  • Next by thread: Re: Getting the default language with AppleScript
  • Index(es):
    • Date
    • Thread