Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

localisation of iphone without changing iphone settings

i had done localisation by changing the language of iPhone through localisableString and by different xib which works only with NSLocale method ,but the requirement of app is to localised it by changing the language in app setting view irrespective of iPhone language..

like image 279
ManjotSingh Avatar asked Nov 06 '22 06:11

ManjotSingh


1 Answers

Sounds like a stupid requirement, but anyway: You can change the language of your app by setting an array with the order of preferred languages for the user defaults key @"AppleLanguages", e.g.:

//Set language to German:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:[NSArray arrayWithObject:@"de"]
                                      forKey:@"AppleLanguages"];

Note however that this only affects strings/nibs you load afterwards, so you might need to reload your UI after changing the setting.

like image 104
omz Avatar answered Nov 09 '22 12:11

omz