This article addresses the challenge of keeping business and service website content consistent for visitors in different regions. It focuses on the technical steps required to declare language information accurately, ensuring that browsers and assistive technologies process text correctly. The discussion covers setting default page languages, handling mixed-language content, choosing appropriate BCP 47 tags, and understanding the distinction between text language and intended audience metadata.
Setting Up Your Multilingual Page Structure
This is a hypothetical example. Picture an author who runs a small consultancy’s public site and is about to add a second language. On her desk sits a folder of English pages: a services overview, three service detail pages, a pricing table, an about page, and a contact page with a short form. Her draft sitemap for the new language lists four candidates for the services section: a single translated page combining all offers, three mirrored detail pages under a language folder, a hub page plus shared service cards referenced from each regional section, and a two-level split that keeps the pricing table separate from service descriptions.
The names matter less than what each candidate implies. The single combined page keeps one entry point but pushes pricing and service detail together, so a visitor comparing offers may scan past the distinction the author intended. The mirrored detail pages preserve one-to-one correspondence with the English structure, which makes future edits easier to trace, but every new service now needs a matching page in each language. The hub-plus-cards option shares one set of service cards across regions, which reduces duplicated description text, yet leaves unclear where region-specific wording, such as service availability or hours, would live. The split option isolates pricing, but then the service pages must each link sideways to the pricing table, and the author has not decided whether that link is repeated in every regional section.
One unresolved trade-off is whether shared fragments (a service card’s short description) count as translated content or as a fixed template, since that decision changes how often the two language versions can drift apart. A second is navigation labeling: the folder-based path suggests the language lives in the address, while the hub-and-cards approach could put language in a selector instead, and the author has not settled which is clearer to visitors arriving from search results. She also has a placeholder note reading “short form labels only,” because the contact form raises a question about whether field labels are translated once or per region.
These examples are invented to frame the structural question. The next step is to choose a shape for the services section that can be repeated across the other page types before any translated text is written.
Declaring the Default Language Attribute
Always put a language attribute on the html element to declare the page's default language; that setting is inherited by all other elements. Use the html element rather than the body element, since body does not cover text inside the document head.1
When the page includes content in another language, add a language attribute to an element surrounding that content so it can be styled or processed differently. If there is no markup around the content, place an element such as span, bdi or div around it.1
Use language tags from the IANA Language Subtag Registry. For HTML served as text/html, use the lang attribute. Avoid a meta element with http-equiv set to Content-Language; in-page declaration takes precedence when determining the actual language of the text.1
You can decide the default language attribute by looking at what your current homepage actually serves most visitors before any regional variant is chosen. Take that as your base: open the live page in a private window with no saved preferences and note which language appears. If English is what an unaffiliated visitor sees, the html element’s lang value can reasonably start as English; if the first screen is a region-specific version, you might use that language instead and treat the other as an alternative.
A practical author action is to write the attribute change as a short before-and-after note in your own content log, without editing the published file yet: record the current value, the proposed value, and one sentence on why the default reflects the unflagged visitor experience. Then check whether any heading or navigation label on that page is already in another language, since a mismatch would make the declaration feel wrong to a first-time reader.
You can also compare two candidate values side by side in that note and choose one for a draft. Label the comparison as a working hypothesis, not a finding. If you later prepare regional pages, the same note gives you a starting point for deciding whether the default stays fixed or shifts per version.
Handling Mixed-Language Content Within Pages
Within a single page, parts written in different languages can each carry their own lang attribute. MDN describes the lang global attribute as a single BCP47 language tag that defines the language of an element, and its example sets one paragraph as British English and another as French. MDN also states that WCAG Success Criterion 3.1.2 requires pages with parts in different languages to specify the languages of those parts too, calling the lang attribute the correct mechanism.2
For unchanged language, MDN describes inheritance: an element without lang or xml:lang inherits the language of its parent element. If no ancestor sets a language, it can also come from the meta element's http-equiv content-language or the HTTP Content-Language header. If no single content language can be determined, MDN says the default is the empty string, with unknown as the content language.2
Start with one page you already publish in two languages, and open the two versions side by side. Choose a single block that mixes languages—for example, an English heading above a translated service description—and mark where a reader would need to switch mental gears. You can then decide whether that block belongs as one unit or should be split into separate language sections.
A concrete author move is to rewrite that block twice: once keeping the mixed pairing, once separating the languages into parallel short paragraphs. Compare them by asking which one lets a visitor follow pricing and service detail without hunting. Write one sentence of reasoning for the version you would keep; label it a working hypothesis rather than a result.
You might also note which phrases in the shared fragments should stay fixed and which can vary by region, then record those choices as open questions for your own review. The aim is a page whose language boundaries are visible to you before you consider changing anything live.
Choosing Accurate BCP 47 Language Tags
BCP 47 defines language tag syntax, with the latest specification being RFC 5646, which obsoletes RFCs 4646, 3066 and 1766. Most tags begin with a two- or three-letter primary language subtag, which must come first. Examples include en for English and ast for Asturian, whose three-letter code is used because no two-letter code exists in the ISO lists.3
The article's stated golden rule is to keep the tag as short as possible, adding region or script subtags only when they add useful distinguishing information. It gives ja rather than ja-JP unless you need to specify Japanese as spoken in Japan, and it-IT should be avoided unless Italian as spoken in Italy must be highlighted.3
Take one page you already publish in two languages and open the two versions side by side. Highlight every place where the language actually changes within the block—a product name kept in English inside a Chinese sentence, or a service label left untranslated. This gives you a concrete sample to reason about before you touch any tag.
For each highlighted item, you can consider which of two tags is more accurate: the tag for the surrounding text, or the tag for the language of the fragment itself. A simple author move is to mark each highlight with a short guess—language of the paragraph, or language of the fragment—and note one reason. For example, a model name you deliberately keep unchanged might be recorded as a fixed fragment, while a translated service description is clearly part of the surrounding language.
You might then choose one block and rewrite it twice in your draft: once treating the mixed fragment as part of the surrounding language, once marking it separately. Compare which version a reader in each region would parse more reliably, and keep the tag choice that matches. Label this as a working hypothesis rather than a finding. If the tag for a fragment remains ambiguous, record it as an open question for your own review rather than filling in a value you cannot justify.
Distinguishing Text Language from Audience Metadata
The HTTP Content-Language header serves a different purpose than the lang attribute on the html element. As the source explains, the header carries metadata about the intended audience of the document rather than the actual language of the text, and may be used for serving the right language version, workflow management, classification, or searching. Unlike an element-level lang attribute, the header can list several languages separated by commas, which suits a document aimed at a multilingual audience.4
For the text itself, the source says the lang attribute should be used so the browser can correctly display or process content, for example for hyphenation, styling, or spell checking. It should always be used on the html element and also on any elements that surround fragments of content in a different language. Author action follows directly: mark each mixed-language fragment with its own language value rather than letting the audience metadata stand in for it.4
Start with the language note you drafted for your homepage, and check whether the audience tag sitting beside it describes the same group. In my invented sample, the page carries a language tag for British English while the regional label points to readers in Ireland. You can treat that mismatch as a prompt for a small edit: rewrite the note so the two tags answer different questions, one about the text itself and one about where the reader is expected to be.
A concrete move is to add one plain sentence distinguishing the two, for example: "This page is written in English; the regional version is for visitors in Ireland." Then compare that version against your earlier draft, which simply said "English, Ireland," and note what a reader now learns that they did not before. This is an author's demonstration, not a tested result, so you might prefer a different wording.
You can also review your other pages for places where the language label has quietly absorbed audience information, such as a tag naming a country when only the text language changed. Keep your own short record of which pages need this separation, and choose the order you want to revise them in.
Best Practices for Consistent Tag Usage
For HTML pages, start with the html element: the source instructs authors to always add a lang attribute to the html tag to set the page’s default language, giving the example value “en.” If the document is XHTML 1.x or an HTML5 polyglot document served as XML, also use the xml:lang attribute with the same value; if the page is served only as XML, use just xml:lang. For values, choose tags from the IANA Subtag Registry, follow BCP 47 syntax when using more than a language subtag, and keep tags as short as possible. The source also says not to use the meta element with http-equiv set to Content-Language, and to use the :lang pseudo-class in CSS for language-dependent styling.5
Consider taking the language tag on one service card and deciding whether it should follow the card's own fragment or the page around it. You can apply that single decision across the other regional versions before rewriting anything. This is a manageable first move because it settles a repeated question without reopening the whole page structure.
A practical author action is to write two short drafts of the same card, one where the tag matches the surrounding page and one where it follows the fragment. Then choose the version that reads more clearly to a visitor scanning the services list. Treat your choice as a working hypothesis you can revisit, not a final standard.
You might also group your existing tags into two columns in your own notes: those that describe language and those that describe audience. Where a tag seems to do both, write a plain replacement sentence beside it. If the surrounding text is English and the regional version is for visitors in Ireland, a sentence such as "This page is written in English; the regional version is for visitors in Ireland" keeps the two ideas separate. You can decide which column each existing tag belongs in before editing any published text.
Frequently asked questions
How can I decide my default language attribute before choosing any regional variant?
You can decide the default language attribute by looking at what your current homepage actually serves most visitors before any regional variant is chosen. Take that as your base: open the live page in a private window with no saved preferences and note which language appears.
How can I mark each highlighted mixed-language item in my own notes with a guess about which language it belongs to?
For each highlighted item, you can consider which of two tags is more accurate: the tag for the surrounding text, or the tag for the language of the fragment itself. A simple author move is to mark each highlight with a short guess—language of the paragraph, or language of the fragment—and note one reason.
How might I organize my existing tags in my own notes by language versus audience?
You might also group your existing tags into two columns in your own notes: those that describe language and those that describe audience. Where a tag seems to do both, write a plain replacement sentence beside it.
Declaring language in HTML . Retrieved 2026-11-09. ↩︎ ↩︎ ↩︎
lang HTML global attribute - HTML | MDN . Retrieved 2026-11-09. ↩︎ ↩︎
Language tags in HTML and XML . Retrieved 2026-11-09. ↩︎ ↩︎
HTTP headers, meta elements and language information . Retrieved 2026-11-09. ↩︎ ↩︎
Working with language in HTML (tutorial) . Retrieved 2026-11-09. ↩︎