<ul dir="auto">
<li>Electron version: 0.36.7</li>
</ul>
<p dir="auto">I would like to be able to customize the button title for an <code class="notranslate">open dialog</code> (<a href="https://github.com/atom/electron/blob/master/docs/api/dialog.md#dialogshowopendialogbrowserwindow-options-callback">https://github.com/atom/electron/blob/master/docs/api/dialog.md#dialogshowopendialogbrowserwindow-options-callback</a>)</p>
<p dir="auto">For example, to say <code class="notranslate">Choose</code> instead of <code class="notranslate">Open</code>:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/1271509/13939892/116feb12-ef96-11e5-95ce-6f15ffa49517.png"><img width="713" alt="screen shot 2016-03-21 at 6 52 12 pm" src="https://cloud.githubusercontent.com/assets/1271509/13939892/116feb12-ef96-11e5-95ce-6f15ffa49517.png" style="max-width: 100%;"></a></p>
<p dir="auto">A Choose dialog is just like an Open dialog, but not only does it have a custom title, it also has a custom name for the “Open” button. Two examples where it is helpful:</p>
<ul dir="auto">
<li>choosing a directory where downloaded files should be saved – you “Choose” the directory</li>
<li>using a dialog to “Import” a file in a different format, not to “Open” a file in your app’s format</li>
</ul>
<p dir="auto">It is used in OS X apps: <a href="https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/OSXHIGuidelines/WindowDialogs.html#//apple_ref/doc/uid/20000957-CH43-SW8" rel="nofollow">OS X Human Interface Guidelines – The Choose Dialog</a>. I don’t know if other platforms have an equivalent.</p>
<p dir="auto">The simplest way to support it would be accepting another option in the <code class="notranslate">options</code> parameter of <a href="https://github.com/atom/electron/blob/master/docs/api/dialog.md#dialogshowopendialogbrowserwindow-options-callback"><code class="notranslate">dialog.showOpenDialog</code></a>. The property name would be something like <code class="notranslate">buttonLabel</code>, <code class="notranslate">openButtonLabel</code>, or <code class="notranslate">prompt</code> (which is OS X’s name for it). The property should contain a string that the button will be renamed to.</p>
<p dir="auto">To implement this for OS X, you just need to add this code to <a href="https://github.com/atom/electron/blob/ea74e825c91d9401851124cfe8deede03c3c79b9/atom/browser/ui/file_dialog_mac.mm#L48"><code class="notranslate">SetupDialog</code> in <code class="notranslate">file_dialog_mac.mm</code></a>:</p>
<div class="highlight highlight-source-objc++ notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="if (!prompt.empty())
  [dialog setPrompt:prompt];"><pre class="notranslate"><span class="pl-k">if</span> (!prompt.empty())
  [dialog <span class="pl-c1">setPrompt:</span>prompt];</pre></div>
<p dir="auto">And also change <code class="notranslate">SetupDialog</code> and its callers to pass <code class="notranslate">prompt</code> in, which would be extracted from the <code class="notranslate">options</code> of <code class="notranslate">showOpenDialog</code>.</p>
<hr>
<p dir="auto">I can imagine that this might be useful for Save dialogs, too – you could change the button to “Save As” or “Export” instead of “Save”. You can probably implement it for <a href="https://github.com/atom/electron/blob/master/docs/api/dialog.md#dialogshowsavedialogbrowserwindow-options-callback"><code class="notranslate">dialog.showSaveDialog</code></a> in exactly the same way as for <code class="notranslate">showOpenDialog</code>. It would make sense that users could pass the same option to customize the button, since those two functions already support mostly the same options.</p>