Abstract:
This page informs about NIB layout issues when it comes to localization. It shows how the One For All
NIB layout method can resolve these issues.
We all know and love the fresh dialog styles from Cocoa NIBs. Here is a rather basic example dialog. Looks nice, fresh and clean.
Now we create a new language (German) in iLocalize which also copies the NIB layouts from English to German. And here is how the German NIB looks like.
You got the issue? Fine. This is what we're all familiar with. We see this every now and then in various apps (even from Apple!). And this is what we're going to fix now for all our Cocoa applications which use NIBs and localization.
You have been doing your NIB layout in Interface Builder (called IB
hereinafter) before, of course. But many of us didn't use the layout rectangle guides before and simply accepted all things like IB adjusted them. – Now let's have a look at the real NIB layout with Layout: Show Layout Rectangles
switched on in IB's menu.
Here you see that the object bounds really fit the English texts. IB likes to adjust the size when you create new objects and enter text. This seems to be nice, but it's part of the problem. The next image shows the layout issue for the German localized version much more impressive.
This is rather easy, once you know what you have to think about. There is no reason why the dialog title (Saving... / Beim Sichern ...) should not be as wide as possible. The representation (without layout rectangles) is exactly the same. But the text object will fit every language (until you have to do some Finnish or Klingon stuff with much more words – see below for more about this).
For the Cancel button, we have found that a standardized width of 108 pixels works best for all pairs of Cancel / OK buttons. This fits all languages we have localized so far. And it's so easy to remember when you're doing new dialog NIBs: 108 is a nice number, really.
This is all you have to keep in mind, basically:
Here is how the One For All
NIB layout fits for both languages in this simple example. (And of course even more complex dialogs would look as good using this method.)
When you're done with the NIB layout adjustments in English this way, create your localized versions (best done in iLocalize) and spread the multi-language versions to your localizers. But inform them first, that they MUST NOT adjust NIB layouts themselves, but rather take screenshots of dialogs which don't fit their language. Then they should send back their localization with the screenshots. You will be able and adjust the relevant English base NIBs quickly, so that they fit the localized strings, too.
Updating the localized NIBs from the adjusted English base NIBs is just a piece of cake using iLocalize. Simply update your project in iLocalize and Reset the layout of each localized nib file from its base-language layout
in the Update From Bundle
process.
Here is a little more complex dialog which can only be cared over time, using the explained method One For All
.