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

  • Home
  • SEARCH
  • 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 7403449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:05:06+00:00 2026-05-29T05:05:06+00:00

I have added this file in my project with the code: Language.h: @interface Language

  • 0

I have added this file in my project with the code:

Language.h:

@interface Language : UIViewController

@end

@implementation Language

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];

}

Here this method +(NSString *)get: is not getting called

+(NSString *)get:(NSString *)key alter:(NSString *)alternate {
NSLog(@"Bundle path: %@", [bundle bundlePath]);

    return [bundle localizedStringForKey:key value:alternate table:nil];
}

@end

And in my viewController.m file where I have two buttons for change of language Turkish and English Language:

-(IBAction)englishLang:(id)sender{

[Language setLanguage:@"en"];
NSLog(@"language to english");

}

-(IBAction)turkishLang:(id)sender{

[Language setLanguage:@"tr"];
NSLog(@"language to turkish");
}

The issue is when I click on turkish lang button, the language should be changed and the next nib file should be turkish localized, picked up by the application. But I am not getting that behavior from my application.

It only loads the english localized nib file.

What can be the issue ?

  • 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-29T05:05:07+00:00Added an answer on May 29, 2026 at 5:05 am

    If you want to use an app language that isnt based on the phones language you need to do a couple of things:

    • make your own version of NSLocalizedString which will return the
      string based on your language, not the phones (it sounds like this is the main problem, if you have NSLocalizedStrings through the app, the value returned will only ever be the same as the language of the phone)
    • post notifications when the language is changed so that your views can refresh with the new content
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have added some code which compiles cleanly and have just received this Windows
I have this code $(.delete2).click(function() { $('#load2').fadeIn(); } I have dynamically added item via
I have a few custom UITableViewCells - http://img11.imageshack.us/i/customfacilitiescell.png/ which are added to this UIViewController
Within a Visual Basic Project I have added a resource file (resx) that contains
I have some code here. I recently added this root_id parameter. The goal of
I have a website project and in that I added a .svc file with
I have added a piece of sharepoint code to the existing java file which
I have added a UILabel to my view programmatically like this: myLabel = [[UILabel
I have a ChildWindow. In this childwindow, I have added properties that link to
I have created a reddot cms component, in which I added this line Also,

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.