Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How simplify iPhone localization?

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.

like image 421
mamcx Avatar asked May 22 '09 14:05

mamcx


1 Answers

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.

like image 170
Rob Napier Avatar answered Sep 29 '22 20:09

Rob Napier