title: change NSLocale/Language of iPhone programmatically in running app
body: <p>I have an issue. I had created a view, where user can select Language of application among English, Dutch &amp; Spanish. Then texts of UILabel in next view should be according to selected language.</p>
  
  <p><strong>I have used following code to set current language :</strong></p>
  
  <pre><code> NSLog(@"%@", NSLocalizedString(@"Loading... Please wait...", nil));
  
   int index = 2;
   NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
   NSArray* languages = [userDefaults objectForKey:@"AppleLanguages"];
  
   switch (index) 
   {
      case 0:
          languages = [NSArray arrayWithObjects:@"en",@"de",@"es", nil];
          break;
  
      case 1:
          languages = [NSArray arrayWithObjects:@"de",@"en",@"es", nil];
          break;
  
      case 2:
          languages = [NSArray arrayWithObjects:@"es", @"en", @"de", nil];
          break;
  
    }
     [[NSUserDefaults standardUserDefaults] setObject:languages forKey:@"AppleLanguages"];
     [[NSUserDefaults standardUserDefaults] synchronize];     
  
     NSLog(@"%@", NSLocalizedString(@"Loading... Please wait...", nil));
  </code></pre>
  
  <p>** And in Localizable.strings (Spanish) : **
        "Loading... Please wait...” = “Loading... in Spanish”;</p>
  
  <p>** And in Localizable.strings (German) : **
        "Loading... Please wait...” = “Loading... in German”;</p>
  
  <p><strong>I have used following code to get current language in next view :</strong></p>
  
  <pre><code> NSUserDefaults* defs = [NSUserDefaults standardUserDefaults];
   NSArray* languages = [defs objectForKey:@"AppleLanguages"];
   NSString* preferredLang = [languages objectAtIndex:0];
   NSLog(@"preferredLang: %@", preferredLang);
  
  
   NSLog(@"%@", NSLocalizedString(@"Loading... Please wait...", nil));
  </code></pre>
  
  <p><strong>But it prints "Loading... Please wait...” in Console. It should print "Loading... in German” instead.</strong></p>
  
  <p><strong>Is am going wrong somewhere ?? Can I change language of application while application is running ??</strong></p>