iOS Localizable.strings not being retrieved from BASE file

I am having a problem getting localization on iOS to work the way I think it is suppose to, but this is my first foray into localization so maybe I am misunderstanding.

I have three Localizable.strings files:

  • IOS: set a default language in xcode for my app
  • Xcode 6 localization failed to read a strings file
  • Localizable.strings not working in iOS
  • How do I localize a string with formatting placeholders?
  • iPhone/iOS: How can I get a list of localized strings in all the languages my app is localized in?
  • Changing the development language in Xcode
  • Base

    "TAB_TITLE_Camera" = "CAMERA";
    

    English

    "TAB_TITLE_Camera" = "Camera";
    

    Spanish

    "TAB_TITLE_Camera" = "Cámara";
    

    NSLocalizedString(@"TAB_TITLE_Camera", nil)
    

    iOS 6.1

    On Xcode 5 with a 4th generation iPod Touch running iOS 6.1, English and Spanish seem to work, but if I change to German (or any other language without a localization file) it does not pull
    from Base Localizable.strings, instead it pulls from the English file.

    Why does it NOT pull from the BASE file?

    Why DOES it pull from the English file?


    iOS 7.1

    Also, with a 5th generation iPod Touch running iOS 7.1, when I change to German it seems to pull from the last selected language that has a localization file, either English or Spanish. Huh?!

    Solutions Collect From Internet About “iOS Localizable.strings not being retrieved from BASE file”

    Found a way to determine whether or not I have a localization file for the currently selected language, and if not, I can pull from the Base localization file.

    NSString *path = [[NSBundle mainBundle] pathForResource:[[NSLocale preferredLanguages] objectAtIndex:0] ofType:@"lproj"];
    if (path == nil)
    {
        path = [[NSBundle mainBundle] pathForResource:@"Base" ofType:@"lproj"];
    }
    
    NSLocalizedStringFromTableInBundle(@"TAB_TITLE_Camera", @"Localizable", [NSBundle bundleWithPath:path], @"");
    

    If the current language is:

    English it returns Camera

    Spanish it returns Cámara

    Anything else that doesn’t have a localization file returns CAMERA

    Simple solution that does everything I need.

    Works on both iOS 6.1 and iOS 7.1.