views:

3560

answers:

4

I need to localiza a in development app for English & Spanish.

Despite the fact I follow the Apple way of use NSLocalizedString & create nibs for both, I already lost the track of the new string that need to get localized and found with surprise that I need to redo the nibs in spanish when I change the master.

(Just like this http://www.gigliwood.com/weblog/Cocoa/A_Great_Need_for_Be.html)

I wonder if exist a better/alternative/more automated way.

I know the use of gettext & poedit and wonder if something like that can be used.

Or if exist some script or tool for this.

+5  A: 

There really isn't an easy fix here. NIBs need to be individually laid out for every language. To some extent, this improves overall user interface, because different languages actually often need different layout to look their best. Russian and German are much "larger" languages in screen real estate than English. Chinese can often be much smaller and a different layout looks better with Chinese characters. Arabic and Hebrew are right-to-left and may need radical changes to layout. Automated layout is easy, but achieves this by being varying levels of ugly in all languages. When given the choice between easy for the developer and ugly vs. difficult for the developer and beautiful, Apple almost always chooses the latter. That said, Apple has still not made it nearly as easy as they could.

So the first lesson here is to keep your NIBs simple. This is easier on iPhone than on Mac because iPhone doesn't have bindings and iPhone NIBs are generally simpler anyway. You can also use text injection for NIBs that have very small amounts of text (like a title). "Text injection" is a fancy way of saying "use an outlet for the label and set it to the localized text when you load the view."

ibtool is able to pull strings out of NIBs and also shove them back in, which can be helpful. I've used iLocalize, which is helpful for working with contract localizers, but doesn't really help with the problem you're talking about.

I tried getting rid of NIBs and just using code, thinking it would make things easier, but it really didn't. It was easier to lay out each language in the NIB than to come up with layout logic that would look good in all languages (see first paragraph). Text injection was only useful in a handful of places. If you can split your NIBs up into ones that need to be localized and those that don't, that can be helpful. On iPhone, I found that less than half of my NIBs actually had text or localized images in them.

Of course you should read Internationalization Programming Topics, but I'm sorry to say there really is no easy answer to your problem. Shipping products localized in 19 languages, I feel your pain.

Rob Napier
+1  A: 

Sometimes NiBs need to be laid out for each language, but most of the time they do not have to be re-laid out for each language.

If you used ibtool to generate the strings from the nibs

ibtool --generate-strings-file

You can import them into new nibs for each language.

ibtool --import-strings-file

These are command line tools so they are scriptable. Take a look at 'man ibtool'

Wenzi
A: 

I did the localization for the text and images. It does the language switching. But some of the text and images still don't want to switch properly. or sometimes it switches entirely, but when I tap on the button images, it shows the other language images for a while though. I don know what has happened. Could anyone help me out with this? Thank you so much. I have been surfing around for this problem, but can't find an answer

Rocker
A: 

There's interesting localization tool - crowdin.net. I guess that is solution you are looking for.

Sergey