Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7218081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T21:26:10+00:00 2026-05-28T21:26:10+00:00

In my application, users can choose a language, so I would like my app

  • 0

In my application, users can choose a language, so I would like my app to change the language accordingly, but it doesn’t work. I have found this code online:

// Force languages
NSString * lang=[[NSUserDefaults standardUserDefaults] stringForKey:@"idioma"];
NSLog(@"language %@",[[NSUserDefaults standardUserDefaults] stringForKey:@"AppleLanguages"]);
if ([lang isEqualToString:@"castella"]) {

    [[NSUserDefaults standardUserDefaults]
     setObject:[NSArray arrayWithObject:@"es"]
     forKey:@"AppleLanguages"];
} //else just default user lang

This code doesn’t work. I think I am just setting up another preference setting. I really want to modify the locale. I have some strings that are localized and also some of the NIB files, so I would like to add the Spanish to prefered locales list on the first position, but I don’t really understand how to do that.

In the settings for the application, I have an option to chose the language. That is not just out of my stubborness; it is just that regional laguages are important here and sometimes the iPhone doesn’t provide support for them, but I pronvide the translations.


From the answers I decided to give up messing with the locale, but would it be possible to show a different NIB file (from en.proj or es.proj)? I already have the first part:

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        NSString * lang=[[NSUserDefaults standardUserDefaults] stringForKey:@"idioma"];

        if ([lang isEqualToString:@"castella"]) {
            //Load NIB filer from "es.proj".
        }
    }
    return self;
}

Is that even possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T21:26:10+00:00Added an answer on May 28, 2026 at 9:26 pm

    Locale should be set by the user in iPhone settings, I think that if you force this parameter from your app you go out of your sandbox and your app could be rejected.

    Instead, add localizations in your NIB files and/or Localizable.strings in your project. Your app will show the best language for the user automatically.

    If you still want to change the language inside your app, then don’t try to change locale setting, but just change what you show on the screen within your app.

    You can save the language you want in [NSUserDefaults standardUserDefaults] and show your labels according to this parameter:

    if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"language"] isEqualToString:@"English"]) {
        aLabel.text = @"This is English.";
    } else if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"language"] isEqualToString:@"Italian"]) {
        aLabel.text = @"Questo e' italiano.";
    } else if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"language"] isEqualToString:@"Japanese"]) {
        aLabel.text = @"これは日本語です。";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have localized application where user can choose her preferred language in dropdown control.
My application supports internationalization and localization, each user can choose his preference language and
I have an application where users can upload video files of any size, and
I have an application where users can store items. Now each type of account
I want to build a web application where users can register and have a
I have a silverlight application which users can install out-of-browser . When the right-click
On a WPF application already in production, users have a window where they choose
As part of a web application users can upload files of data, which generates
In an application where users can belong to multiple groups, I'm currently storing their
I've developed an application that users can use to store lists of their favourite

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.