More on Localization

A couple weeks back I posted about using ibtool’s localize-incremental command to update your localized nibs. A very handy command.

In theory.

If it actually worked.

It sometimes works. And other times it seems to get confused and do nothing. In those cases something a little more brute force might be in order.

First let me say that this is only going to work if the only differences in your localized nibs is the actual text. If you’ve tweaked the positions of UI elements or call different methods in your localized nibs, then you’ll need to redo all those tweaks.

After you’ve made all of your changes in the native localization, we’ll say English, export the localized strings from all of your localized files.

ibtool --export-strings-file de.strings de.lproj/MyController.xib
ibtool --export-strings-file es.strings es.lproj/MyController.xib
ibtool --export-strings-file fr.strings fr.lproj/MyController.xib
ibtool --export-strings-file it.strings it.lproj/MyController.xib

Then copy the native xib over the localized versions.

cp en.lproj/MyController.xib de.lproj/MyController.xib
cp en.lproj/MyController.xib es.lproj/MyController.xib
cp en.lproj/MyController.xib fr.lproj/MyController.xib
cp en.lproj/MyController.xib it.lproj/MyController.xib

Then import the localized strings back into your nibs.

ibtool --import-strings-file de.strings de.lproj/MyController.xib --write de.lproj/MyController.xib
ibtool --import-strings-file es.strings es.lproj/MyController.xib --write es.lproj/MyController.xib
ibtool --import-strings-file fr.strings fr.lproj/MyController.xib --write fr.lproj/MyController.xib
ibtool --import-strings-file it.strings it.lproj/MyController.xib --write it.lproj/MyController.xib

It’s still a bit messy. But much easier than the manual alternative.