Message language and text direction

Declare the message language and mark bidirectional runs so pronunciation, punctuation, numerals, and reading order remain correct.

What it is

The lang attribute identifies language; dir and bidirectional markup establish reading direction for right-to-left and mixed-direction text.

Why it matters

Assistive technology chooses pronunciation from language. Bidirectional text can display punctuation, phone numbers, and embedded addresses in the wrong order without markup.

How to implement

Set lang and dir on the HTML root, override them for passages in another language, and use dir="auto" carefully for user-generated fragments.

Common mistakes

  • Using text alignment instead of direction.
  • Mirroring logos or media controls.
  • Concatenating an LTR identifier into RTL text without isolation.

Verification

Read with a screen reader configured for each language and test mixed names, dates, prices, URLs, and phone numbers in RTL clients.

Sources

  1. WCAG 2.2 — Language of Page — W3C
  2. W3C — Structural markup and right-to-left text — W3C