Updating Localized Nibs

This is probably common knowledge, but I’m writing this down here for my own benefit as much as anyone else. And maybe there’s a better way to do this, but this is what I’m doing.

We’ve been sort of hit and miss when it comes to localizing our apps over at Griffin, but we’re getting much better as of late, which is awesome. What’s not so awesome is replicating fifty-eleven changes to fifty-eleven localized nibs manually.

It turns out there is command line tool called ibtool that can help. You’ll need to provide the modified nib, the original version, the localized nib that you wish to update and someplace to write the new localized version to. Or you can just write it in place.

The first step is to grab a copy of the nib before it was modified. We use git, so I did something like this:

git cat-file blob HEAD:en.lproj/MyNib.xib > en.lproj/MyNib_original.xib

Now that we have a copy of the original, we can use nib tool to update a localized version like this:

ibtool --previous-file en.lproj/MyNib_original.xib --incremental-file en.lproj/MyNib.xib \
--localize-incremental --write de.lproj/MyNib_new.xib de.lproj/MyNib.xib

Just do that for each nib you’ve localized and you should be all set. Much less tedious and error-prone than replicating changes to your localized nibs manually.