views:

746

answers:

2

I'm working on internationalizing an iPhone application, and I'm using ibtool to extract the string from my xib files so they can be translated by a localization house like so:

ibtool --generate-strings-file BlahBlahView.strings English.lproj/BlahBlahView.xib

The problem with this is that the .strings file I end up with contains all the strings contained in the xib when I really want the subset that I actually care about for i18n. Is there any best best practice for dealing with this? Ideally I'd like to be able to add some kind of annotation in interface builder to say either "This is localizable" or "This is not localizable" and have ibtool only output the localizable strings when I run it.

Thanks!

Edit: OK, let me expand the parameters a bit. The solution doesn't need to use ibtool only. Ibtool + some data in the xib + a shell script is fine. As long as it works!

+1  A: 

I think you can automate this, but it'll take a few steps. You can extract arbitrary properties from your xib using ibtool, so maybe you could set the tag of the non-localizable items to a particular value (-1, for example), then extract the tags and use that to filter the strings file and remove the unwanted entries.

check out the man page for ibtool, in particular the -export option.

Mark Bessey
+2  A: 

Ibtool is extremely verbose in its string-files output and generates stirngs by object-id, instead of by unique source string.  This type of output is extremely useful when you're trying to re-create interface builder or otherwise need extensive control over the objects in your xib files, but less so when you simply want to localize your software.

Matteo at Digitalwaters.net found a way to convert the output from ibtool to and from the format used by nibtool, its predecessor, which was less powerful, but a lot easier to use for localization. More info here.

I have re-purposed his scripts to streamline the localization of our Mac OS X app, and they work well for me.  Good luck :)

Dirk Stoop