Localization with IB fails

Hi,

I localized my mainWindow.xib with XCode - but still, the second language (German) is not visible if I am setting my emulator to german. My hardcoded NSLocalizedText commands work - but not the XIB I set with IB - there is only the English version loaded.

Did I forget something?

macbook air, Mac OS X (10.5.5)

Posted on Jul 15, 2010 10:29 PM

Reply
4 replies

Jul 16, 2010 11:36 PM in response to sommeralex

Hi Alex -

Did you select Build->Clean All Targets before testing?

Make sure MainWindow.xib (English) is in the same folder as Localizable.strings (English), and MainWindow.xib (German) is in the same folder as Localizable.strings (German). None of these four files should be in the parent directory. The tree should look like this in Finder:

|Localizable.strings
|English.lproj-|
| |MainWindow.xib
--------
| |Localizable.strings
|German.lproj--|
|MainWindow.xib

If the directory structure isn't correct, don't try to fix it in Finder. To delete the language tree, click "Remove All Localizations" at the bottom of the General tab page in the Xcode Info window for each localized file (e.g. Localizable.strings and MainWindow.xib), then start over.

When rebuilding the language tree, make sure to click "MakeFileLocalizable" at the bottom of the General tab page in the Xcode Info window for each localized file (e.g. Localizable.strings and MainWindow.xib), then click Add Localization on that same page, once for each additional language. After Xcode has made the correct directory structure, you can use Finder to replace any of the files in the lproj folders so long as you remember to Clean All Targets before building.

- Ray

Jul 19, 2010 4:42 PM in response to sommeralex

sommeralex wrote:
thanks! is this, what you are telling, something I can find in the documentation? Or is it just experience 🙂

Good question, Alex! It's not always easy to say how or where we learned something. Almost everything is covered somewhere in the docs, but that doesn't mean we found the relevant passage when we needed it, or that we could have interpreted the info without the experience of several failed attempts.

In this case, there are puzzle pieces scattered thoughout +Internationalization Programming Topics+, for example: [Generating Localized Nib Files|http://developer.apple.com/iphone/library/documentation/MacOSX/Conceptual /BPInternational/Articles/LocalizingInterfaces.html#//apple_ref/doc/uid/20002138 -97292], while others are in the [Localizing Files|http://developer.apple.com/iphone/library/documentation/DeveloperTools/Co nceptual/XcodeProjectManagement/170-Localizing Files/localizing.html#//appleref/doc/uid/TP40002683-CFHIFBGJ] chapter of the +Xcode Project Management Guide+. But I'm not claiming I got my first localization working on the first try after reading those docs.

\- Ray

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Localization with IB fails

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.