Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to localize MenuBar on mac os x

I'm working on an app for Mac OS X. Now I want every word, title or string displaying on the interface to be localized.

For the time being, I've done most of the work, but I'm confused by the MenuBar in MainMenu.xib.

Is there any method for me to translate the MenuBar item's title directory? Or do I have to make IBOutlet for each item and set their title as an NSLocalizedString?

like image 854
LYTTE_LJ Avatar asked Dec 18 '25 03:12

LYTTE_LJ


1 Answers

You should definitely take a look at the documentation on localization. Importantly, though, Apple has changed some of the steps as Xcode 4 has evolved; so many of the tutorials have some incorrect steps now. I'll restrict my comments to localization of nibs since that was the nature of the question.

Add new localization in Project/Info tab

Add localization

Just click the (+) which will show a popup menu of localization languages. Choose one.

Choose which resources you want to localize

Choose resources

Localize the nib Now, in the Project Navigator, the MainMenu.xib which I chose to localize has a French localization:

Now multiple localizations under xib

Note that all of your IBOutlets and actions are preserved. Now you can simply work on the display text, formatting, size of UI elements etc. to correspond to the selected xib.

Localization of nib

like image 85
FluffulousChimp Avatar answered Dec 20 '25 20:12

FluffulousChimp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!