Re: Accessing Localized File Menu String
Re: Accessing Localized File Menu String
- Subject: Re: Accessing Localized File Menu String
- From: Chris Page <email@hidden>
- Date: Thu, 9 Jul 2009 22:15:19 -0700
On Jul 9, 2009, at 12:51 PM, Ian was here wrote:
I have an AppleScript that clicks a menu item under Keynote's file menu. This works great. The problem is when I localize it.
The working version of the script is as follows:
if (exists menu item "Export…" of menu 1 of menu bar item "File" of menu bar 1) then click menu item "Export…" of menu 1 of menu bar item "File" of menu bar 1
The localized version is this:
set localizedFileString to localized string "File" set localizedExportString to localized string "Export…"
if (exists menu item localizedExportString of menu 1 of menu bar item localizedFileString of menu bar 1) then click menu item localizedFileString of menu 1 of menu bar item localizedFileString of menu bar 1
"Export" is in Keynote's dictionary and will translate to German, but "File" is not in Keynote's dictionary and won't translate. Does file belong to the Finder? What I want to know is how to translate "File" so that I can use it in my localized AppleScript.
Note that you should not rely upon being able to get at an application’s resources, including its localized strings. The “localized string” scripting addition runs inside whichever application you send it to, but applications aren’t designed to let scripts get at their localized strings and any scripts that do so are not guaranteed to work, or to continue working in the future. “localized string” is intended for script applets that contain localized strings of their own, for their own purposes.
The specific answer to your question is: The names of menus and menu items are not necessarily in localized *.strings files. They’re usually only within nibs. “localized string” only knows how to look inside *.strings files.
-- Chris Page
The other, other AppleScript Chris
|
_______________________________________________
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