title: Execute unit tests in Xcode that test localization in several languages
body: <p>I have an app that uses several different languages, and my goal is to have unit tests that can verify the translated text matches our source material.</p>
  
  <p>So far, I have tried &amp; read the following without great success:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/1669645/how-to-force-nslocalizedstring-to-use-a-specific-language">How to force NSLocalizedString to use a specific language</a></li>
  </ul>
  
  <p>This is partially successful, but the problem is that the language change does not take effect until the next time the app launches. I can live with this, but would like to have more control, such that I don't have to launch the tests and then re-launch to test the language I want.</p>
  
  <ul>
  <li><a href="https://developer.apple.com/library/content/technotes/tn2339/_index.html#//apple_ref/doc/uid/DTS40014588" rel="noreferrer">Building from the Command Line with Xcode FAQ</a></li>
  </ul>
  
  <p>I read this Apple document on command line builds, and it looks promising since I can specify a scheme. I duplicated my app's scheme, and modified the language under <code>Run</code> in this case to be Spanish, as seen here:</p>
  
  <p><a href="https://i.stack.imgur.com/NrlSL.png" rel="noreferrer"><img src="https://i.stack.imgur.com/NrlSL.png" alt="enter image description here"></a></p>
  
  <p>However, under <code>Test</code>, I have options to use the arguments &amp; environment variables set in <code>Run</code>, but nothing about using its <code>Options</code>.</p>
  
  <p><a href="https://i.stack.imgur.com/k0FWL.png" rel="noreferrer"><img src="https://i.stack.imgur.com/k0FWL.png" alt="enter image description here"></a></p>
  
  <p>Launching the app under my modified scheme with the Run language set to Spanish does not get me Spanish strings unfortunately.</p>
  
  <p>Finally, I know there is an option under Test / Options to show non-localized strings, but this does not solve my problem of are they correct.</p>
  
  <p><a href="https://i.stack.imgur.com/bscft.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bscft.png" alt="enter image description here"></a></p>
  
  <p>To perform on device testing is extremely time consuming due to the need to trigger various edge cases that generate errors, which is why I want the unit tests to do it for me.</p>