开发者

change locale programmatically

HI all,

i hv a table view showing 4 languages english开发者_如何学Python,spanish,german and french,

i created xib's for each view, also created Localizable.strings. everything is working fine when i change language from simulator. whole app gets changed according to language selected..

what i m trying to do is,instead of changing language from simulator's directory of language, i want to change language through my table view,which shows languages. if i tap on table with spanish values, whole app should changes its language.

can we do this.

like simulator's language setting changes language of whole simulator, i want to change language of my app through my app.

hope for a quick reply

help is always appreciated

regards shishir


Try the following thing.

NSArray *languages = nil;

languages = [NSArray arrayWithObject:@"en"];
[[NSUserDefaults standardUserDefaults] setObject:languages forKey:@"AppleLanguages"];
[[NSUserDefaults standardUserDefaults] synchronize];

NSString *localizedStr = NSLocalizedString(@"ABOOK", @"Hello");
NSLog(@"String 11 = %@", localizedStr);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜