Jason
Jason

Reputation: 14615

Best strategies to internationalize an already-created iPhone app?

I know that to internationalize an iPhone app, you create a "strings" file in Interface Builder and set the different kinds of strings that will be displayed in your app. However, this is much easier to do starting from the outset than if you want to internationalize an already-coded, mostly-finished app. Besides the obvious hurdle of actually translating all of the text in your app, what are the best strategies for actually going about internationalizing your app when it is already created, with wacky text-modifying code and all built into the app using Objective-C functions?

Upvotes: 4

Views: 1273

Answers (1)

rjobidon
rjobidon

Reputation: 3155

The search in project function can make you save a lot of time...

I search @"" in the project and replace every occurrence with NSLocalizedString().

To save even more time:

  • Add the comment "// Do not localize" at the end of line of code to leave strings as is
  • The first parameter of NSLocalizedString should give as many details as possible.
    For example I use: BUTTON-ACTION-PRINT-VERB-10CHARS to indicate: user interface element type, is it a verb or a noun, the action and space available (in multiple of capital W letter).
  • Leave as nil the last parameter of NSLocalizedString - it's not useful
  • Add a comment before each string in the string file to explain context
  • Eliminate all the text-modifying code with formatted strings (%@ %i %f)

It's the simplest way to proceed, and once it's done you can add languages with no effort!

Good luck,

rjobidon

Upvotes: 4

Related Questions