Re: What gets automatically localized?
Re: What gets automatically localized?
- Subject: Re: What gets automatically localized?
- From: Jerry Krinock <email@hidden>
- Date: Wed, 6 Jan 2010 18:21:01 -0800
On 2010 Jan 05, at 14:11, Dave DeLong wrote:
> I'm working on localizing an application, and I've been trying to figure out what the runtime/OS/whatever will automatically localize for me (specifically referring to the standard menubar). Obviously, if I add my own NSMenuItems, I have to localize them myself. Some menuitems seem to be translated automatically (Undo, Redo, Special Characters), while others don't (Find, Spelling, Services). Is there any rhyme or reason to why some menuitems get localized without intervention and others don't? Do I, for example, need to manually localize "About MyApp", "MyApp Help", "Hide MyApp", "File" (the menu title), "Edit" (menu title), etc?
Yes, you do. It's an interesting question, though. I believe that Undo, Redo and Special Characters are three special cases.
Regarding the first two, from Apple's Undo Architecture document,
"NSUndoManager automatically localizes the “Undo” and “Redo” portion of the command titles, but merely appends the action name to them."
which will be backwards for languages that put the direct object before the verb. They go on to say,
"If you want to further customize how these titles are localized, you can create a subclass ofNSUndoManager and override undoMenuTitleForUndoActionName: andredoMenuTitleForUndoActionName:."
There is a somewhat magical, though. NSUndoManager provides the methods undoMenuItemTitle and redoMenuItemTitle, but NSUndoManager does not send the -setTitle: messages to the "Undo" and "Redo" menu items. Apparently something else in the Cocoa runtime system gets the titles from the undo manager and sends them to the menu items. But how does this thing know which menu items are "Undo" and "Redo"? Maybe while the app is launching, the runtime iterates through your main menu for items targetted to the undo: and redo: actions.
Regarding "Special Characters", this item will be added to your Edit menu even if you don't put it in your xib. So a second lesson is: You only need to localize the things that you put in your xib. And a second question is: How does the Cocoa runtime know which menu item is your "Edit" menu?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden