Re: How to detect application using which language by AS?
Re: How to detect application using which language by AS?
- Subject: Re: How to detect application using which language by AS?
- From: Christopher Nebel <email@hidden>
- Date: Mon, 22 Jul 2002 19:10:41 -0700
On Monday, July 22, 2002, at 09:22 AM, bill wrote:
Some applications in Mac OS X have the options to choose language, is
there any way to detect the language used by application?
For example, the Script Editor, if we select the application, show
info, choose languages in the combo box, there are a list of language
available. If we select French only, the next time we activate Script
Editor, every menu items are in French, and the about is changed to
"Editeur de Script".
Any idea of how to use applescript to acknowledge Script Editor is
showing francais?
AppleScript Studio 1.1 lets you do this, though not quite how you might
think.
The way this works is that the application says, for example, "give me
the localized string for 'Script Editor'". (Notice that it doesn't ask
for the French string specifically.) The system then roots around in
the application's resources for the "best" language according to the
user's preferences as set in the International preference panel, and
comes up with a string, e.g. "Editeur de Script", and hands that back.
(The various strings are stored inside ".lproj" folders in the
application's Resources folder -- if you open up the application
package, you can snoop around.) The cool thing about all this is that
the application doesn't have to have a bunch of "if"s all over the place
saying "if it's English, use this string; if it's French, use that
string; etc.", and someone can add a new language just by adding some
files to the application bundle.
AppleScript Studio has a "localized string" command that lets you do the
lookup -- give it a reference string, and it will return the localized
one, assuming it exists at all.
--Chris Nebel
AppleScript Engineering
_______________________________________________
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.