Localizing menus

Trevor DeVore lists at mangomultimedia.com
Mon Jan 28 12:12:22 EST 2008


On Jan 28, 2008, at 11:55 AM, Mark Smith wrote:

> I've got this little freeware app for backing up files from an iPod,  
> and one of my french users has asked about localizing it.
> I've read through the past threads on the list, and I've got a  
> decent custom property scheme working for all the bits and pieces in  
> the UI.
> However, I'm wondering about the menus - this is on OS X.
>
> Take the 'Edit' menu. Setting the label of btn "Edit" to  
> "Édition" (extracted from my cp set) at start up is no problem, but  
> then I need to replace the menuItems "Cut, Copy, Paste" with their  
> localized counterparts, and also respond to the menuPick messages  
> for each. This seems quote complicated. Has anyone some advice they  
> can give me?

Mark,

What I've done in the past is have one function that returns a string  
for a UI element. The parameter passed is the english equivalent. So  
to assign the edit menu label to the French equivalent I would do this:

set the label of button "Edit" to getLangStr("edit")

Basically I have on custom property set that getLangStr uses to lookup  
the translation for the current language.

I then use the same function to build up the menus and respond to the  
menupick message (since you can't rely on menuhistory with hierarchal  
menus):

on menuPick pChosen

     switch pChosen
         case getLangStr("Cut")

             break
         case getLangStr("Copy")

             break
         -- etc.
     end switch
end menuPick

So that is one way to approach it.

-- 
Trevor DeVore
Blue Mango Learning Systems
www.bluemangolearning.com    -    www.screensteps.com


More information about the use-livecode mailing list