2

I want to make the language changeable from the application settings. For that I made a settings.bundle and i forced the langauge using this code How to force NSLocalizedString to use a specific language , I also put the UIApplicationExitsOnSuspend to YES to make my app reload every time it goes to the background. It partially worked for me but I have 2 problems : - The splash screen (which is localized) is not changing with this method. - I must enter/goBack twice to make the language change effective on the application Views an this only on the OS 4 and higher.

Has anyone a solution for that?

Community
  • 1
  • 1
marouen
  • 21
  • 1

3 Answers3

0

You need to create you own translation framework for that ! Sorry !

VdesmedT
  • 9,037
  • 3
  • 34
  • 50
0

Unfortunately there's no built-in way. What would be probably easiest would be integrate service like GetLocalization.com, so that your app would download language file via API (then it's easy to add new languages and translations even app is already released). Then what you need is just simple loader that loads that language file to memory and function that replaces the original string with translated one in run-time. You can calculate hash for original string so it's fast to search them, good algorithm for this is Peter Weinberger's hashPJW.

petteri
  • 354
  • 2
  • 7
  • Thank you petteri for your answer. It's an option that i didn't tought about. But at least now I'm sure now that the solution I began is a deadEnd. – marouen Dec 30 '10 at 13:11
0

The trick to use specific language by selecting it from the app is to force the NSLocalizedString to use specific bundle depending on the selected language ,

here is the post i have written for this http://learning-ios.blogspot.com/2011/04/advance-localization-in-ios-apps.html

and here is the code of one sample app https://github.com/object2dot0/Advance-Localization-in-ios-apps

object2.0
  • 891
  • 1
  • 12
  • 12