title: Multiple Localized .strings Files in iOS App Bundle
body: <p>I have a fairly complicated project, consisting of several large localized sub-projects.</p>
  
  <p>Most of my sub-projects are localized through a single <strong>Localizable.strings</strong> file. This file is copied into a <code>SubProjectName.bundle</code> target, which is used in conjunction with a <code>SubProjectName.a</code> static library in the main project. This works fine.</p>
  
  <p>However, one of my sub-projects contains many localized .strings files. <em>This project fails to read strings in any language other than English</em>, regardless of how the device (or simulator) is configured.</p>
  
  <p>For example, this line of code always returns the English string:</p>
  
  <pre><code>[[NSBundle myResourcesBundle] localizedStringForKey:@"MY_TEST_STRING" value:@"" table:@"MyTable"]
  </code></pre>
  
  <p>Where <code>MyTable</code> corresponds to a MyTable.strings file localized into several languages. When I peek into the .app package, all the localizations are there, sitting inside the "MyBundle.bundle" resource within the app.</p>
  
  <p>The following code, however, correctly finds the translations for a given string in all localizations:</p>
  
  <pre><code>for (NSString *language in [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"])
  {
      NSBundle *bundle = [NSBundle bundleWithPath:[[NSBundle myResourcesBundle] pathForResource:language ofType:@"lproj"]];
      NSLog(@"%@: %@", language, NSLocalizedStringFromTableInBundle(@"MY_TEST_STRING", @"MyTable", bundle, nil));
  }
  </code></pre>
  
  <p>So when the bundle is the actual <code>MyBundle.bundle/&lt;LanguageCode&gt;.lproj</code> folder, the string lookup works. But obviously this defeats the purpose of the automatic lookup provided by iOS.</p>
  
  <p>(Note that <code>[NSBundle myResourcesBundle]</code> above is simply a static convenience method to fetch my custom bundle for the sub-project).</p>
  
  <p>--</p>
  
  <p><strong>Edit</strong>: I've been experimenting with this some more, and if I delete the <code>en.lproj</code> folder from my sub-project's bundle, then it correctly uses the locale of the device or simulator.</p>
  
  <p>For example, I have:</p>
  
  <pre><code>MyApp.app/
   |
    - MyResources.bundle/
        |
         - en.lproj/
        |
         - zh-Hans.lproj/
  </code></pre>
  
  <p>When I set the simulator (or device) to Chinese Simplified <em>it looks up strings in <code>en.lproj</code> even though the locale is <code>zh-Hans</code></em>. If I delete the <code>en.lproj</code> folder and restart the app it correctly uses the zh-Hans localization.</p>