Change language in app without restarting

Discussion in 'iOS Programming' started by geelenstef, Dec 11, 2012.

  1. geelenstef macrumors newbie

    Joined:
    Dec 11, 2012
    #1
    Hello,

    I want to be able that users can change the language inside the app. I set up my language files correctly. Now In my view I have 2 buttons. One for dutch and one for English. Here is the code behind those buttons.

    Code:
    - (IBAction)changeDutch:(id)sender {
        
        [[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"nl", nil] forKey:@"AppleLanguages"];
        [[NSUserDefaults standardUserDefaults] synchronize];
    }
    - (IBAction)changeEnglish:(id)sender {
        [[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"en", nil] forKey:@"AppleLanguages"];
        [[NSUserDefaults standardUserDefaults] synchronize];
    }
    This works fine when I restart the app. But I don't want that the user first should restart it.

    Can anybody help me?

    Kind regards
     
  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    The language support in Cocoa works by restarting the app. There's not a supported way to change the language dynamically while the app is running.

    I think this topic has been discussed on the Apple iOS forum.
     

Share This Page