title: How to insert Spotlight for Help into localized macOS applications?
body: <p>I am implementing a Java application using the Swing GUI framework on macOS. When using the <em>system</em> look and feel and a <em>screen</em> menu bar, Swing automatically inserts a <em>search field</em> called <a href="https://developer.apple.com/library/content/documentation/Carbon/Conceptual/ProvidingUserAssitAppleHelp/user_help_concepts/apple_help_concepts.html#//apple_ref/doc/uid/TP30000903-CH205-BABBDDJC" rel="nofollow noreferrer">Spotlight for Help</a> into the first menu labelled <code>&quot;Help&quot;</code> of the menu bar of a frame:</p>
  <p><a href="https://i.stack.imgur.com/IPR8K.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IPR8K.jpg" alt="Help menu with search feature" /></a></p>
  <pre class="lang-java prettyprint-override"><code>System.setProperty(&quot;apple.laf.useScreenMenuBar&quot;, &quot;true&quot;);
  
  try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  } catch (Exception e) {
    e.printStackTrace();
  }
  
  JFrame frame = new JFrame();
  JMenuBar menuBar = new JMenuBar();
  JMenu helpMenu = new JMenu(&quot;Help&quot;);
  menuBar.add(helpMenu);
  frame.setJMenuBar(menuBar);
  </code></pre>
  <p>As my application is localized, the English string <code>&quot;Help&quot;</code> is different in other locales (e.g. <code>&quot;Aide&quot;</code> in French). But in those cases Swing does not insert Spotlight for Help since the string is different:</p>
  <p><a href="https://i.stack.imgur.com/IfDar.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IfDar.jpg" alt="Help menu without search feature" /></a></p>