System Language (and user defaults in mac os x)

Alex Rice alex at mindlube.com
Wed Dec 4 00:50:01 EST 2002


On Tuesday, December 3, 2002, at 07:12  PM, Monte Goulding wrote:
>
> I actually think it's something that should be a built in function.
> Particularly for MacOS as the engine does not hide the language menu. 
> But if
> there is an applescript/file based or shell solution then I'm eager to 
> hear
> it.

In OS X, the user's language preferences are accessible via the 
UserDefaults system, which you can access via the shell. Or via my 
Cocoa-Revolution bridging external which doesn't exist yet ;-)

However, from the shell type the command:

defaults read NSGlobalDomain

You will see an AppleLanguages array in the listing.

AppleLanguages = (
         English,
         German,
         French,
         Dutch,
         Italian,
         Japanese,
         Spanish,
         etc...
);

This array is the "preferred order" for languages as set in the 
International | Language system preferences pane. Note that it's an 
ordered preference; so the Finder, System, etc will use the 1st 
languages, but your applications will be localized depending if they 
support any of the prioritized languages. Other fancy stuff:

defaults read NSGlobalDomain > global-defs.plist
open global-defs.plist

OR to browse all of your user defaults for all of your apps:

defaults read > defs.plist
open defs.plist

The "open" command opens the Apple PropertyList Editor with the plist 
in an outline view. From there you can save it out as XML. Or just 
browse it.

The new UserDefaults system is very good and I highly recommend 
developers to start using it once Revolution can hook into it; or even 
use if from the shell via the defaults command. Compliant apps save 
their user defaults under a domain named "tld.domain.AppName" e.g. 
"com.mindlube.Slacker".

Although if you are going for more cross-platform ease then using a rev 
stack or text file for saving user defaults probably makes more sense.

Alex Rice, Software Developer
Architectural Research Consultants, Inc.
alrice at ARCplanning.com
alrice at swcp.com






More information about the Use-livecode mailing list