title: Xcode localization - how to create localized strings for development language
body: <p>Using Xcode 7's localization export workflow, I can export to Xliff, which  can be provided to translators, who will give back a translated version, which we import again.</p>
  
  <p><strong>However, how do I generate one for the original development language?</strong></p>
  
  <p>I want to do this so that I don't have to maintain my development language strings files manually by hand.</p>
  
  <p>Here is the scenario:</p>
  
  <ol>
  <li>I start with <strong>no strings file</strong> in my project, just Swift code which uses the <code>NSLocalizedString</code></li>
  </ol>
  
  <p><code>
  static let something = NSLocalizedString("something.hello", tableName: "MyStuff", value: "Hello world!", comment: "some comment")
  </code></p>
  
  <ol start="2">
  <li><p>From the project settings, I choose <strong>Editor -> Export for Localization</strong>. Because I have no existing strings files, when I export, there are no options. Just a "save as" prompt. </p></li>
  <li><p>This will perform an Xliff export from the original source code. (Same as when you choose "Include: Development Language only" from the prompt when other localizations already present). The Xliff looks like this, with only <code>&lt;source&gt;</code> tags, and no <code>&lt;target&gt;</code> tags.</p></li>
  </ol>
  
  <p><code>
        &lt;trans-unit id="something.hello"&gt;
          &lt;source&gt;"Hello world!&lt;/source&gt;
          &lt;note&gt;some comment&lt;/note&gt;
        &lt;/trans-unit&gt;
  </code></p>
  
  <ol start="3">
  <li><p>The Xliff file is modified by translators, and translated to simplified chinese</p></li>
  <li><p>The translated Xliff file is re-imported into project via Xcode</p></li>
  <li><p>This creates the <code>MyStuff.strings</code> file for simplified chinese</p></li>
  <li><p>Problem - when I run the app, the app will use the chinese strings file, even when language is english, because an english file doesn't exist. It doesn't seem to use the default <code>value</code> anymore. This means I need an english strings file too.</p></li>
  </ol>
  
  <p><strong>How can I generate an english (the development language) version of the strings files through the import/export process? Xcode doesn't let me "export" in the original development language. So I can't re-import it to create the strings files.</strong></p>
  
  <h2>Note on <code>genstrings</code></h2>
  
  <p>In the documentation for <a href="https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/InternationalizingYourCode/InternationalizingYourCode.html#//apple_ref/doc/uid/10000171i-CH4-SW3" rel="nofollow">Separating User-Facing Text from Your Code</a>, it says <em>"Alternatively, you can generate the development language strings files from NSLocalizedString macros directly, as described in <a href="https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/MaintaingYourOwnStringsFiles/MaintaingYourOwnStringsFiles.html#//apple_ref/doc/uid/10000171i-CH19-SW1" rel="nofollow">Creating Strings Files for User-Facing Text in Your Code</a>."</em> , which tells you to use <code>genstrings</code></p>
  
  <p>However that <strong><code>genstrings</code> no longer works for Swift when you specify the <code>tableName</code></strong>.
  It's my understanding from what I've seen on SO that multiple radars have been filed, but it seems Apple is no longer supporting it.</p>