Reputation: 2413
I am trying to internationalize my application. In have localized my application properly and the language of the application gets change on changing the iPhone language from settings but what I want is that the application's language should be changed in running application on click of a button (i have defined two buttons, one for english and one for turkish).
I am using below code to change the language.
- (void)viewDidLoad{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//localization
self.usernameLabel.text = NSLocalizedString(@"UserName", nil);
self.passwordLabel.text = NSLocalizedString(@"PassWord", nil);
self.loginLabel.text = NSLocalizedString(@"Login", nil);
english.tag=ENGLSIH_LANGUAGE;
turkish.tag=TURKISH_LANGUAGE;
currentLanguage=ENGLSIH_LANGUAGE;}
-(IBAction) languageChanged:(id)sender{
UIButton *clickedButton=(UIButton *)sender;
switch (clickedButton.tag) {
case ENGLSIH_LANGUAGE:
currentLanguage=ENGLSIH_LANGUAGE;
NSLog(@"Language Changed ");
break;
case TURKISH_LANGUAGE:
currentLanguage=TURKISH_LANGUAGE;
NSLog(@"Language Changed ");
break;
default:
break;
}
}
How can I achieve that and load the localized nib file.
Upvotes: 1
Views: 1030
Reputation:
To internationalize your application, try this link, it will be helpful for you
Internationalizing the application on the fly
Upvotes: 1