brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: translate="no" keeps browser translation away from names and code

Web
~/tips/tip-html-translate-no

and open <span translate="no">Home Assistant</span> in your browser.

Stops translation tools from translating code, commands and product names on a page.

Plenty of people in the Netherlands read English tech sites through the browser’s translate button. That works surprisingly well, until it turns a command into Dutch or translates a product name. The translate attribute tells translation tools which parts to leave alone, and I’d put it on every code sample and brand name on a technical page.

<p>
  Start it with <code translate="no">docker compose up -d</code>
  and open <span translate="no">Home Assistant</span> in your browser.
</p>

A translated version of this paragraph keeps the command and the product name exactly as written, and translates the rest. Without the attribute, “Home Assistant” could easily come back as a Dutch phrase that no search engine will find.

The attribute takes yes (or an empty value) and no, and the HTML spec says elements without it inherit the setting of their parent. So you can switch off a whole block and switch a part of it back on:

<pre translate="no">
  <code>docker logs -f homeassistant</code>
</pre>

<div translate="no">
  <span>nextDash</span>
  <p translate="yes">This line may be translated.</p>
</div>

The caveat: it’s a request, not a lock. MDN notes that not every browser recognizes it, though automatic translation systems such as Google Translate respect it. Don’t confuse it with lang either. lang says what language a piece of text is in, translate="no" says it shouldn’t be touched. Set both properly and translators and screen readers get the right information.

In browser compatibility terms it’s Baseline widely available since September 2025: Chrome 19, Safari 6, and Firefox since version 111.

Further reading: MDN: translate attribute, HTML Standard: the translate attribute

More Web tips async function sha256(text) { url = URL.createObjectURL(file); function setFilter(name, value) { …the page behind the drawer… inputmode="numeric" autocomplete="one-time-code"> All Web tips (6) All topics

Link