Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • NSLog with Locale

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 271
    Comment on it

    NSLocale class provides information about system language like the language that iPhone is currently running on, the list of supported language etc.

    To get the current language code use following lines of code.

    NSString *code = [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode];
    NSLog(@Current language code: %@, code);
    

    output: Current language code: en

    If you need the language name, use above language code to get language name.

    NSString *language = [[NSLocale currentLocale] displayNameForKey:NSLocaleIdentifier value:code];
    NSLog(@Language name: %@", language);
    

    Output: Language name: English

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: