Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…

Read the release notes

translate

Marks text and translatable attribute values that machine translation must leave alone: code, brand names, identifiers. Inherited; empty means yes.

Overview

The translate attribute tells translation tools (a browser's "Translate page", translation services, and tools used by human translators) whether an element's text and its translatable attributes should be translated. Everything is translatable by default. Set translate="no" on content that must stay as written. It has no visible effect until someone translates the page.

Applies to: every element (it is a global attribute). It is inherited by descendants.

Values

ValueMeaning
yes or "" (empty)Translate this element's text and translatable attributes.
noLeave them unchanged.
Absent or an unknown valueInherited from the parent. The root defaults to yes.

Translatable attributes

translate covers these attribute values as well as text:

  • title on any element
  • alt on img, area and input
  • placeholder on input and textarea
  • label on option, optgroup and track
  • value on input type="button" and type="reset"
  • abbr on th
  • download on a and area
  • content on meta name="description" and name="keywords"
  • srcdoc on iframe

What a user types into a field is never translated, so translate="no" on a text input only protects its placeholder and title.

Examples

Code in documentation

Placeholders and titles that must not change

Brand names

When to keep the default

Leave prose, headings, labels, button text, error messages and navigation translatable. Do not put translate="no" on a whole page or component to protect a few words.

In Vanilla Breeze

  • No CSS can do this. The CSS translate property is a transform; machine-translation opt-out only exists as this HTML attribute. VB's i18n stylesheet has no rules for it on purpose (src/native-elements/i18n/styles.css, section 4).
  • Mark code yourself. VB does not add translate="no" to <code>, <kbd>, <samp>, <pre> or <var>. The i18n guide asks authors to mark them in markup.
  • data-lorem placeholder text gets translate="no" automatically, so translation tools do not try to translate Latin filler (src/utils/lorem-init.js).

Accessibility

  • Translation is an accessibility tool. Many readers rely on it. Mark only what must stay unchanged, so the rest stays readable.
  • It does not set the language. Untranslated text in another language still needs lang for screen readers.

Browser support

Baseline widely available since 2025 (Chrome 19, Firefox 111, Safari 6). Translation services such as Google Translate honour it regardless of the browser.

Gotchas

  • It is a request. Translation tools generally honour it, but nothing enforces it.
  • class="notranslate" is an older Google Translate convention. translate="no" is the standard; you do not need both.
  • Inheritance cuts both ways. translate="no" on a container protects every descendant. Use translate="yes" on a child to re-enable translation inside it.

Related

Which to choose

  • translate="no" — text that must survive translation unchanged.
  • lang — text in a specific language that may or may not be translated.
  • data-i18n with VB's VbI18n — your own translated UI strings, swapped by script.
↑