---
title: "Mark foreign words · Agent Wranglers"
url: https://agentwranglers.se/playbook/localization/multilingual-websites/lang-attribute
id: LOC-6
level: Required
risk: law
updated: 2026-10-22
tokens: 667
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Mark foreign words

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Multilingual websites](https://agentwranglers.se/playbook/localization/multilingual-websites.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-22.

- ID: LOC-6
- Level: Required
- Chapter: [Multilingual websites](https://agentwranglers.se/playbook/localization/multilingual-websites.md)
- Rule: Mark every passage in another language with its own `lang` attribute.
- Check: An accessibility checker such as axe reports no `valid-lang` failures. A test keeps a list of the foreign phrases the site uses, and finds each one inside an element with a matching `lang`.
- Risk: A law broken
- How: Wrap foreign phrases in `<span lang="…">`, using valid language codes. This is WCAG 2.2 success criterion 3.1.2, Language of Parts. In email, follow [Declare the language and text direction](https://agentwranglers.se/playbook/email/message-basics/language-and-direction.md).

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### HTML example

```html
<p>The French call it <span lang="fr">mise en place</span>: everything in its place.</p>
```

## Sources

- [WCAG 2.2 (3.1.2 Language of Parts)](https://www.w3.org/TR/WCAG22/#language-of-parts)
- [RFC 5646 (Tags for Identifying Languages)](https://www.rfc-editor.org/rfc/rfc5646)

## Related rules

- EML-5 [Declare the language and text direction](https://agentwranglers.se/playbook/email/message-basics/language-and-direction.md) in Email
- LOC-7 [Keep names out of machine translation](https://agentwranglers.se/playbook/localization/multilingual-websites/translate-attribute.md) in Localization

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/localization/multilingual-websites/lang-attribute">Agent Wranglers localization playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [List language versions in the sitemap](https://agentwranglers.se/playbook/localization/multilingual-websites/sitemap-hreflang.md)
- Next: [Keep names out of machine translation](https://agentwranglers.se/playbook/localization/multilingual-websites/translate-attribute.md)
- [Multilingual websites](https://agentwranglers.se/playbook/localization/multilingual-websites.md)
