• 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: Accessing Localized File Menu String
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing Localized File Menu String


  • Subject: Re: Accessing Localized File Menu String
  • From: Yvan KOENIG <email@hidden>
  • Date: Mon, 20 Jul 2009 21:34:21 +0200


Le 20 juil. 2009 à 17:49, Yvan KOENIG a écrit :


Le 10 juil. 2009 à 08:37, Chris Page a écrit :

On Jul 9, 2009, at 10:30 PM, Philip Aker wrote:

Any solution in sight for scriptors? In a recent discussion it was found out that some often used Apple applications are setting both the 'name' and the 'title' of menu items to the localized string. This makes it impossible to ask for a menu by an unchanging term and consequently one is forced to use an index (which may be unreliable between releases). I'm not sure if nib tools usable for this situation are available on a user setup which doesn't have the Developer tools installed.

The solution is to report bugs against those applications. <http://bugreport.apple.com/>

A workaround might be to use the available command-line tools to harvest localized strings from the nibs and place them in *.strings files in your script bundle. This ties the script to a particular version of the target application, but could be updated automatically if you wrote a script to do it.

If I understand well, we are supposed to be able to do the trick with nibtool.
Alas, Nib files embedded in Apple's applications like iWork or even TextEdit are 'compiled' so nibtool returns an error message when we try to use it.

Is there a trick to get rid of that ?
It's quite pitiful to read that the correct path is to grab datas from the nib files when these ones can't be treated.
At this time, I'm just able to get a raw list of every menu items titles but they are not ordered the same so, it's a huge task to find which local string is the translation of a given English one.

For Numbers, I did the trick for French, Da and Dutch but it's really boring.

Maybe I missed the trick allowing us to deal with compiled nibs.

I got a new step.

With a non-Apple application, I was able to build lists of localized menu titles with this script:

--[SCRIPT]
property testTextEdit : false

set locales to {"English", "French", "da", "Dutch", "fi", "German", "Italian", "no", "pl", "pt_PT", "pt", "Spanish", "sv", "ru", "Japanese", "ko", "zh_CN", "zh_TW"}

set dest to "Build_menuResources:"
set shared to ".app:Contents:Resources:"

if testTextEdit then
set p2nib to (path to desktop folder as text) & "TextEdit" & shared
set n2nib to "Edit"
else
set p2nib to (path to desktop folder as text) & "Maintenance" & shared
set n2nib to "MainMenu"
end if

repeat with i from 1 to count of locales
set loc to (item i of locales) as text


set the_Nib to p2nib & loc & ".lproj:" & n2nib & ".nib:"
set the_Strings to dest & loc & ".strings"
tell application "System Events"
if exists disk item the_Strings then delete disk item the_Strings
set flag to exists disk item the_Nib
end tell
if flag then
set theStrings to (quoted form of (POSIX path of the_Strings))
set theNib to (quoted form of (POSIX path of the_Nib))
try
do shell script "nibtool -L " & theNib & " > " & theStrings
on error
tell application "System Events" to delete disk item the_Strings
end try
end if -- flag


end repeat

--[/SCRIPT]

Alas, if I apply it on an Apple application like TextEdit,  I get the error :

nibtool: could not load '/Users/yvan_koenig/Desktop/TextEdit.app/Contents/Resources/French.lproj/Edit.nib/': Unable to initialize classManager IBClassData.
In fact, I get the same on every non English lproj.

As I already wrote, on iWork's components I get the error message:
nibtool: could not load '/Applications/iWork '09/Numbers.app/Contents/Resources/English.lproj/Numbers.nib/': Unable to initialize classManager IBClassData
for every lproj because the nibs are compiled.

Is there a way to break the wall ?

Yvan KOENIG (from FRANCE lundi 20 juillet 2009 21:34:13)


 _______________________________________________
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

References: 
 >Accessing Localized File Menu String (From: Ian was here <email@hidden>)
 >Re: Accessing Localized File Menu String (From: Chris Page <email@hidden>)
 >Re: Accessing Localized File Menu String (From: Philip Aker <email@hidden>)
 >Re: Accessing Localized File Menu String (From: Chris Page <email@hidden>)
 >Re: Accessing Localized File Menu String (From: Yvan KOENIG <email@hidden>)

  • Prev by Date: Adium
  • Next by Date: MS word scripting
  • Previous by thread: Re: Accessing Localized File Menu String
  • Next by thread: Re: Accessing Localized File Menu String
  • Index(es):
    • Date
    • Thread