I have requirement like below: In my application I have provided list for language. Now when user change language then it should change all Titles and messages to particular language. Actual flow is like, I have one Screen (view) for setting in my app. In that setting screen I have provided language option.Now when user select language then in my application all Titles, Messages should get displayed in selected language without starting my app.
Now issue is when I select language for example Spanish then it is not taking effect without restarting my app. I have used function as given below:
-(void) SetUserLanguage
{
NSString *appDataFilePath = [[NSBundle mainBundle] pathForResource:@"UserLanguageList" ofType:@"plist"];
NSDictionary *appDataDictionary = [[NSDictionary alloc] initWithContentsOfFile:appDataFilePath];
NSString* langName = [appDataDictionary objectForKey:self.pstrUserLanguage];
if(langName == nil || [langName isEqualToString:@""])
{
langName = @"en";
}
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSArray *langArray = [defaults objectForKey:@"AppleLanguages"];
NSArray *currentLangArray = [NSArray arrayWithObject:langName];
[defaults setObject:currentLangArray forKey:@"AppleLanguages"];
[defaults synchronize];
}
above function is part of one interface called UserDataManager and instance of that is available globally for application using gpUserDataManager. So on selection of language I set language to this structure and then I have my predefined plist file for mapping.So when user select language Spanish it set value "es" to preferred language in above function. But to have effect of this change I need to restart my app. Kindly help how to achieve my requirement.