Why the language tag matters on an onboarding page
Two WCAG criteria, 3.1.1 and 3.1.2, ask onboarding pages to declare their language: the whole page and any passage in another language. The lang attribute tells browsers and assistive technology which language a page is written in.
Key takeaways
- Declare the page language once, on the html element, in the page layout.
- Mark each passage written in another language with its own lang value.
- Use a valid BCP 47 value, because an empty lang leaves the language unknown.
- Check the page source of every onboarding layout, and repeat the check after each release.
Onboarding guides are often the first long pages a new customer reads. They explain how to connect a data source, invite teammates, set permissions, and finish setup. When those pages are hard to use, customers stall, and customer success managers are usually the ones who hear about it. Language markup is a small part of that usability work, and it is easy to miss because nothing on the screen changes when it is absent.
Every HTML page can say what language it is written in. That statement lives in the markup, so browsers and assistive technology can read it without anyone having to tell them. If the page does not say, the language is in an unknown state.
Accessibility is the main reason this matters for onboarding. The Web Content Accessibility Guidelines (WCAG) include two success criteria that cover language. They are the subject of this post, and they belong on your publishing checklist, not only on a developer's to-do list.
What the two criteria ask for
The first criterion, 3.1.1, concerns the page as a whole. The lang attribute reference on MDN describes it this way: WCAG Success Criterion 3.1.1 requires that a page language is specified in a way that can be programmatically determined, through the lang attribute. In plain words, the language of each page has to be written into the markup, where software can find it, rather than left for software to infer.
The second criterion, 3.1.2, concerns parts of a page. Under it, the criterion "requires that pages with parts in different languages have the languages of those parts specified too." An English onboarding guide that includes a Spanish button label, a French quote, or a sample message in another language needs those pieces marked as well.
| Criterion | What it covers | Where the value goes | Onboarding example |
|---|---|---|---|
| 3.1.1 | The whole page | The lang attribute on the html element | Every guide built from the same layout |
| 3.1.2 | Each part that differs from the page language | The lang attribute on the element around that part | A Spanish button label inside an English guide |
Put together, the two criteria cover the whole page and every passage within it that differs from the page language.
Set the page language on the html element
The lang attribute is a global attribute, so any HTML element can carry it. On a page, you usually put it on the opening html tag, like this:
<html lang="en-US">
The attribute is one that
helps define the language of an element. On the html element, that element is the whole page, so the value you write there describes the main text of every guide built from that layout. Use the language the page's main text is written in. If your guide is written in American English for customers in the United States,
en-US
fits. The value describes what the content is written in, not where a reader lives or which language their browser uses. Choose one form and use it everywhere.
Set this value once, in the page layout, not by hand on each guide. A layout-level declaration means every new onboarding page starts out with the same correct declaration, and a person writing a new guide does not have to remember anything. The rest of this post covers the exceptions: sections in other languages, form fields, and layouts that were never set up properly.
Choose a valid value under BCP 47
The W3C's guide, Declaring language in HTML, says that "The rules for creating language attribute values are described by an IETF specification called BCP 47." It adds that "BCP 47 incorporates, but goes beyond, the ISO sets of language and country codes." In practice, a value can be a language code on its own, or a language code followed by a region or other part, as the content requires. For most onboarding guides, the language code and a country or region is all you need.
The practical risk is a typo or an invented format. The rules are blunt: if the language tag "is not valid according to BCP47, it is set to invalid." An invalid value does not do the job the declaration exists to do. That makes validation worth building into your workflow. Check values against BCP 47 with a validator rather than trusting memory, and keep a short list of approved values for your team so that everyone uses the same ones.
When the language is empty, missing, or invalid
Three situations look like a declaration but are not. The first is an empty value. The rule is that "If the attribute value is the empty string (lang=\"\"), the language is set to unknown." A layout may ship with an empty lang as a stand-in value, and the page then appears to be declared to anyone who only checks that the attribute is present. An empty value leaves the language unknown, which is not the same as declaring it.
The second is an invalid value, covered above.
The third is no declaration at all. With no declaration anywhere, "the language is in an unknown state if there's no indication of language anywhere." That is the state of any page whose layout never set the attribute, and it is the state that 3.1.1 rules out, because it requires the page language to be specified.
| Markup on the html element | What software sees | What to do |
|---|---|---|
| lang=\"en-US\" | A declared page language | Keep it, and check it against the approved list |
| lang=\"\" | An unknown language | Replace the empty value with a valid one |
| No lang attribute | An unknown state | Add the attribute in the page layout |
| lang=\"english\" | An invalid value | Replace it with a valid BCP 47 tag |
A quick way to find these cases is to open the page source of every onboarding layout and read the first few lines. If you see lang=\"\" or no lang at all on the html element, fix the layout before you look at anything else.
How language flows down the page
Language is inherited. The rule is simple: "If an element has no lang or xml:lang attribute, it inherits the language of its parent element." That is the reason a single declaration on the html element covers the whole page, and you only need to add a lang attribute where something differs.
Inheritance has a limit, and it is the one 3.1.2 is about. A block of text in another language still inherits the page language unless you mark it. A parent declaration cannot tell the software that the text inside a child element is written in Spanish, so the child needs its own value.
Overrides work the other way too. A child element with its own lang value uses that value, and the rest of the page keeps the parent's. So a Spanish section inside an English page gets its own value, and the surrounding English text does not change.
For layout owners this is useful. They can set a value high in the page and then override only the few elements that need it. That keeps the number of exceptions small and easy to audit.
Mark the parts written in another language
Here is a common situation. Your onboarding guide is in English and tells the customer to click a button whose label appears in another language, because the product interface has been localized. Or your guide quotes a teammate's message in Portuguese. To handle that, put those words in an element that has its own lang value, as in this example:
<p>Click <span lang="pt-BR">Salvar</span> to save your changes.</p>
Keep the marked element as small as the words that change language. A whole paragraph in another language gets the attribute on the paragraph. A single word inside an English sentence gets it on a span around that word. The smaller the marked element, the less the rest of the page is affected.
Borrowed words are harder. A product name, a technical term, or an English word used in a Japanese guide may or may not count as a change of language, so it is a judgment call. Write down your team's policy, such as marking only full phrases and leaving single loanwords alone, and apply it the same way across every guide.
Illustrative example: an invite page
Suppose you publish a guide called "Invite your team." The page is in English, but the invite screen has a Spanish button label, and the guide quotes a Spanish-speaking admin. The markup below shows the declarations in place:
<html lang="en-US">
<body>
<h2>Invite your team</h2>
<p>Choose the button labeled <span lang="es">Invitar</span>.</p>
<blockquote lang="es">
<p>Invitar a mi equipo fue sencillo.</p>
</blockquote>
</body>
</html>
The example marks only the Spanish words. The English text inherits the page language, so it needs no attribute. Without those marks, software would read the Spanish words with the English page language, the situation 3.1.2 describes.
Fields where customers type
The attribute can also describe "the language that non-editable elements are written in, or the language that the editable elements should be written in by the user." That gives onboarding teams a second use. If a setup form asks the customer to type a company name or a short description in a particular language, the field can carry a lang value that says so.
Use this only where you actually know the language. If a field accepts text from many languages, or you cannot say which language to expect, leave the attribute off rather than guessing. A wrong value can look like a deliberate choice to whoever reads the markup later. The label and the input are separate elements, so each can carry its own value. For contrast and focus cues on these fields, see Form control contrast: 3 rules for cues and focus.
Working with the people who own the page layouts
The most useful thing you can bring to a developer or web team is a clear request. A good request names the pages, the language each page is written in, and any sections in other languages, with the exact text and the target language. It also says what done looks like: the html element carries a valid value, and every marked section has its own value.
A vague request, such as "make the pages accessible," leaves the engineer to guess which pages, which language, and which sections. A specific request turns the work into a short checklist. Keep the request in the same ticket as the guide so the reason for each value is recorded alongside the page.
If your team uses a content management system, ask whether the language can be set on each page or in each layout. If the system only allows one value for the whole site, and your site serves guides in several languages, you will need to discuss the structure with the people who maintain it.
A review routine for your team
The review should be a routine others can follow. A simple version looks like this:
- List every onboarding page and every layout that produces them.
- For each layout, open the page source and check the opening html tag for a valid lang value.
- Search each guide for passages, buttons, quotes, or captions in another language, and confirm each one has its own lang value.
- Check every value against BCP 47 and against your team's approved list.
- Ask someone who uses a screen reader, or a text-to-speech tool, to read one guide from start to finish. Listen for words that are read in the wrong way.
- Repeat the check after every release that touches the layouts or adds translated content.
For wider testing of setup pages, see Onboarding flow tests: 4 setup checks before launch.
The listening step is not a substitute for checking the markup. It catches problems that a source review can miss, such as a label that looks right on screen but is spoken with the wrong pronunciation.
Keep a log of the results. A dated list of which layouts passed and which still need work makes it easy to see progress, and it gives the next person a starting point.
Common mistakes
A few errors come up again and again.
Leaving lang=\"\" as a default. An empty value is not a declaration. Treat any empty value as a defect to fix.
Marking the translated section but not the text around it, or the reverse. Both halves need correct values. A marked Spanish section inside an English page with no page-level value leaves the rest of the page unknown.
Mixing formats across pages. One guide says en-US, another says en, and a third uses a value that nobody approved. Pick a format and enforce it.
Assuming the browser fills the gap. A visitor's browser language setting is a preference on their device. It is not the declaration in your page, and your page should say what it is written in.
Skipping the review after content changes. Translated sections often get added during updates, and they are the easiest to forget.
Your next step today: open the page source of one onboarding guide and read the opening html tag. If lang is missing or empty, fix it in the page layout before you change anything else.
Related guides: Onboarding tools: compare 4 customer project plans · Follow-up delay limits: 4 checks before onboarding mail · Multi-page form progress: 7 settings to check.
Questions teams ask
Do I need a lang attribute on every page? Yes. The first criterion applies to each page, so every page needs its own declaration that software can check against 3.1.1.
Can I put one value on the html element and skip the rest? Only if every passage on the page is in that language. Otherwise, mark the parts that differ. That is what 3.1.2 covers.
What if a guide is in two languages on purpose? Choose the language that the main text is in for the html element, and mark each block in the other language. A side-by-side guide may need a different structure, so ask your web team to review the layout.
Does the lang attribute replace translation? No. The attribute describes the language of the content. Translating a page is a separate job, and it is done by writing or reviewing the text itself.
Do I have to memorize BCP 47? No. Keep an approved list and use a validator. The background reading explains the details if you want them.
Keep the declaration current
The simplest standing guidance is also the most direct: "It is recommended to always specify an appropriate value for this attribute, especially due to accessibility concerns." Treat that as a standing rule for your onboarding library, not as a one-time cleanup. Every new guide, every new layout, and every translated section is a chance to set the value correctly or to leave it wrong.
A small habit goes a long way. Check the declaration when you publish, check it again when you update, and make sure whoever owns the layouts knows the list of approved values. The two criteria come down to a page-level value and a set of marked passages.
Sources
Limits of this post
This post is general operational information, not legal advice about notice periods or renewal clauses. It does not promise that any method keeps a customer. Software can get a fact wrong, so open the sources before you act.