0

I have found two ways to enable localization for iOS project:

  1. Creating localized .xib files
  2. Creating localized .string files

I have read up so much about both the methodologies, even I have tried both the ways. But which one should be better to use and why? Please guide me.

Mrunal
  • 13,982
  • 6
  • 52
  • 96

2 Answers2

3

Really, it depends. I usually end up with a mix of both. When layout really matters, I'll have separate .xibs. But a single .strings file is a lot more convenient to work with.

(And no, adjust to width is not a polished solution most of the time.)

David Dunham
  • 8,139
  • 3
  • 28
  • 41
2

The first choice is the right way to do. The number 1 reason is, not all languages are of same length. German is usually a "wider" language than English whereas Chinese is a "narrower" language. This means, if your UIButton measures 100px x 37px in English, it needs to be 130px x 37px in German and around 70px X 37px for the Chinese version. You don't have this finer controls when creating a localized string files. The downside is, if you are editing a XIB (like adding another button) you have to add it to all the XIBs. The workaround is to design one XIB to cater to the widest language and use localized string files, but then, your UI will not look polished. So at the end it boils down to a "polished UI for the user" vs "extra development time" and you have to make that decision.

Secondly, some languages like arabic are right to left and you have to customize the layout of the XIB to reflect that. (May be if it is a form, UILabel go on right and UITextFields on left?)

Mugunth
  • 14,461
  • 15
  • 66
  • 94
  • Yes I know all what you written, regarding german-chinese. But your answer seems diplomatic to me, I am still not being clear about which to use. "polished UI for the user" vs "extra development time" - means what you trying to convey? – Mrunal Feb 17 '12 at 17:15
  • Regarding text length, we can set font size - adjust to fit width, no need to change button size. – Mrunal Feb 17 '12 at 17:16
  • It's really up to you to decide what's important for you: this depends on the budget, targeted release time, the complexity of the UI, the targeted audience, ... – sch Feb 17 '12 at 18:14
  • Mugunth isn't being diplomatic. This is the trade-off. Unlocalized XIBs tend to look mediocre-to-bad in a variety of languages. Making your app look great in all languages costs more time, effort and money. A similar discussion is here: http://stackoverflow.com/questions/898308/how-simplify-iphone-localization – Rob Napier Feb 17 '12 at 18:29
  • Note that the answer to you initial question is: you use both. It's not either-or. – Rob Napier Feb 17 '12 at 18:31
  • Thanks Mugunth Kumar, Rob Napier for discussing. Its been really helpful to me. – Mrunal Feb 17 '12 at 18:40
  • Please check this one: http://stackoverflow.com/questions/9338713/memory-management-in-ios-localization-with-strings-file – Mrunal Feb 18 '12 at 04:59