title: How can I change application language inside the application?
body: <p>I would like to change application language inside the app without restarting.</p>
  
  <p>There are Localizable.strings files for both languages. All my XIBs and main Storyboard too.</p>
  
  <p>Te below code can change the language only after restarting an app</p>
  
  <p><strong>main.m:</strong></p>
  
  <pre><code>int main(int argc, char *argv[])
  {
      NSString *currLang = [[NSUserDefaults standardUserDefaults] stringForKey:@"Lang"];
  
      if (!currLang) {
          NSString *languageCode = [[NSLocale preferredLanguages] objectAtIndex:0];
          if ([languageCode isEqualToString:@"ru"]) {
              [[NSUserDefaults standardUserDefaults] setValue:languageCode forKey:@"Lang"];
          }
          else [[NSUserDefaults standardUserDefaults] setValue:@"en" forKey:@"Lang"];
  
          [[NSUserDefaults standardUserDefaults] synchronize];
      }
  
      currLang = nil;
      currLang = [[NSUserDefaults standardUserDefaults] stringForKey:@"Lang"];
      if ([currLang isEqualToString:@"ru"]) {
          [[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"ru", @"en", nil]
                                                    forKey:@"AppleLanguages"];
      }
      else
          [[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"en", @"ru", nil]
                                                forKey:@"AppleLanguages"];
  
      [[NSUserDefaults standardUserDefaults] synchronize];
  
      @autoreleasepool {
          return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
      }
  }
  </code></pre>
  
  <p>There are 2 buttons (Eng &amp; Ru) ant the method:</p>
  
  <pre><code>- (IBAction)changeLang:(UIButton *)sender
  {
      if ([sender isEqual:btnSetRuLang]) {
          if ([[userDefaults stringForKey:@"Lang"] isEqualToString:@"ru"]) {
              return;
          }
          [userDefaults setValue:@"ru" forKey:@"Lang"];
          [userDefaults synchronize];
      }
      else {
          if ([[userDefaults stringForKey:@"Lang"] isEqualToString:@"en"]) {
              return;
          }
          [userDefaults setValue:@"en" forKey:@"Lang"];
          [userDefaults synchronize];
      }
  
      NSString *currLang = [userDefaults stringForKey:@"Lang"];
      NSString *alertBody;
      if ([currLang isEqualToString:@"ru"]) {
          [userDefaults setObject:[NSArray arrayWithObjects:@"ru", @"en", nil]
                                                    forKey:@"AppleLanguages"];
          alertBody = @"Перезапустите приложение для смены языка";
      }
      else {
          [userDefaults setObject:[NSArray arrayWithObjects:@"en", @"ru", nil]
                                                    forKey:@"AppleLanguages"];
          alertBody = @"Restart application for change language";
      }
  
      [userDefaults synchronize];
  
      UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Hom" message:alertBody delegate:self cancelButtonTitle:@"Ok" otherButtonTitles: nil];
      [alertView show];
  
  }
  </code></pre>
  
  <p>So, how should I change lang without restarting app?</p>
  
  <p>Thank you.</p>