Top Tips since Localization is a bi**ch!

So for one of my apps, i started the process of localization. It is such a drag, if i knew ahead of time that it was going to be a painfully long process , i would have definitely done things differently. So here are some top tips:

1)  Even if you don’t ever want to localize your application, three months from now you may change your mind, so as a precaution, always use the   NSLocalizedString(<#key#>, <#comment#>) macro even if you don’t plan on immediately adding localization.

2) When you create the localizable.strings file, make sure another library that you have e.g rate this app,sharekit dosent already contain a localizable.strings file. What happens in this case, is that on every other compile, you will notice that your localization will work every other time. To fix this, rename the localization.strings file and in your code, instead of using      NSLocalizedString(<#key#>, <#comment#>) use NSLocalizedStringFromTable(<#key#>, <#tbl#>, <#comment#>) instead where tbl is the bane of the renamed localization file.

3) when using the     NSLocalizedString(<#key#>, <#comment#>) , make sure your key is the full text, e.g instead of using a key such as “exp_ttle” use “Export Title” , this is because the key is also the default value, so if the user is in a territory that you have not localized for, instead of reading “exp_ttle” they will see “Export Title” which is the default. (p.s i wish i had known about this , i ended up having to redo a 2000 word localization.strings file …)

4)  For table views that use localized text, its necessary to remove hard coded table heights, and instead use dynamic table row heights based on the size of the string. Something like this:

CGSize constraint = CGSizeMake(200, 570);

CGSize size = [[NSString stringWithFormat:@”%@ %@”,NSLocalizedString(@”nottsettings”, nil),NSLocalizedString(@”title”, nil)] sizeWithFont:[UIFont fontWithName:@”MyriadPro-Regular” size: 14.0] constrainedToSize:constraint lineBreakMode:NSLineBreakByWordWrapping];

return size.height;
Hope this helps someone getting started with localization, ill update this post as i come up with more top tips

Good luck localizing your ios/Mac OSX app