title: iPhone application localization
body: <p>In my MainViewController I am using this code:</p>
  
  <pre><code>static NSBundle *bundle = nil;
  
  +(void)setLanguage:(NSString *)l {
  
  NSLog(@"preferredLang: %@", l);
  NSString *path = [[ NSBundle mainBundle ] pathForResource:l ofType:@"lproj" ];
  bundle = [[NSBundle bundleWithPath:path] retain];}
  
  
  +(void)initialize {
  
  NSUserDefaults* defs = [NSUserDefaults standardUserDefaults];
  NSArray* languages = [defs objectForKey:@"AppleLanguages"];
  NSString *current = [[languages objectAtIndex:0] retain];
  [self setLanguage:current];
  }
  
  +(NSString *)get:(NSString *)key alter:(NSString *)alternate {
  return [bundle localizedStringForKey:key value:alternate table:nil];}
  </code></pre>
  
  <p>And in application main:</p>
  
  <pre><code>[[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"tr", @"en", nil] forKey:@"AppleLanguages"];
  </code></pre>
  
  <p>Its working fine and showing the turkish language in my application other than the iPhone native language. But, I want to allow the user to change the language through buttons, like if user clicks on english language button, a dialogue should open that application will be restarted and your lang will be changed.</p>
  
  <p>How to do that?</p>
  
  <p>I am using iOS 5....</p>