Skip to content
Sections
Fiesta

locale-menu

Route The pieces that are a whole response rather than a piece of one.

The language switcher: a details menu of one-field POST forms, so the choice is sent to your app and the reader stays on the same path.

Each example is live, but its links go nowhere. HTML shows the markup to copy.

Twelve languages, current highlighted.

Each language is a one-field form, so choosing one is a POST your app answers. A static site can use a menu of plain links instead.

Preview
<footer rst-page-foot>
  <details rst-dropdown rst-locale name="rst-menus">
    <summary>
      Language
      <span rst-caret aria-hidden="true">
        <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>
      </span>
    </summary>
    <div rst-dropdown-menu>
      <form method="post" action="/_locale">
        <input type="hidden" name="locale" value="en">
        <input type="hidden" name="return" value="/">
        <button type="submit" lang="en" aria-current="true">English</button>
      </form>
      <form method="post" action="/_locale">
        <input type="hidden" name="locale" value="ga">
        <input type="hidden" name="return" value="/">
        <button type="submit" lang="ga">Gaeilge</button>
      </form>
      <form method="post" action="/_locale">
        <input type="hidden" name="locale" value="zh-Hans">
        <input type="hidden" name="return" value="/">
        <button type="submit" lang="zh-Hans">简体中文</button>
      </form>
      <form method="post" action="/_locale">
        <input type="hidden" name="locale" value="es">
        <input type="hidden" name="return" value="/">
        <button type="submit" lang="es">Español</button>
      </form>
      <form method="post" action="/_locale">
        <input type="hidden" name="locale" value="hi">
        <input type="hidden" name="return" value="/">
        <button type="submit" lang="hi">हिन्दी</button>
      </form>
      <form method="post" action="/_locale">
        <input type="hidden" name="locale" value="pt-PT">
        <input type="hidden" name="return" value="/">
        <button type="submit" lang="pt-PT">Português</button>
      </form>
      <form method="post" action="/_locale">
        <input type="hidden" name="locale" value="bn">
        <input type="hidden" name="return" value="/">
        <button type="submit" lang="bn">বাংলা</button>
      </form>
      <form method="post" action="/_locale">
        <input type="hidden" name="locale" value="ru">
        <input type="hidden" name="return" value="/">
        <button type="submit" lang="ru">Русский</button>
      </form>
      <form method="post" action="/_locale">
        <input type="hidden" name="locale" value="ja">
        <input type="hidden" name="return" value="/">
        <button type="submit" lang="ja">日本語</button>
      </form>
      <form method="post" action="/_locale">
        <input type="hidden" name="locale" value="yue">
        <input type="hidden" name="return" value="/">
        <button type="submit" lang="yue">廣東話</button>
      </form>
      <form method="post" action="/_locale">
        <input type="hidden" name="locale" value="vi">
        <input type="hidden" name="return" value="/">
        <button type="submit" lang="vi">Tiếng Việt</button>
      </form>
      <form method="post" action="/_locale">
        <input type="hidden" name="locale" value="ar">
        <input type="hidden" name="return" value="/">
        <button type="submit" lang="ar">العربية</button>
      </form>
    </div>
  </details>
</footer>

In an app this would reach /_locale. Here its links and forms go nowhere.