<p dir="auto">On Mac OS X, you can change the text of the primary "OK" button in open and save dialogs by providing a "prompt": <a href="https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSSavePanel_Class/index.html#//apple_ref/occ/instp/NSSavePanel/prompt" rel="nofollow">https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSSavePanel_Class/index.html#//apple_ref/occ/instp/NSSavePanel/prompt</a></p>
<p dir="auto">It'd be great to make this an option on the dialog APIs. We want to show an open dialog and ask the user to create / select a folder where files will be saved, and change the prompt from "Open" to "Choose".</p>
<p dir="auto">Slightly related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="148701941" data-permission-text="Title is private" data-url="https://github.com/electron/electron/issues/5178" data-hovercard-type="issue" data-hovercard-url="/electron/electron/issues/5178/hovercard" href="https://github.com/electron/electron/issues/5178">#5178</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>