Detailed answer
Set lang on the root html element using a valid language tag such as en or hi.
It helps software interpret text and choose pronunciation. Mark a passage in another language on a suitable surrounding element. Language metadata describes the actual content; it does not translate the document.
Example
<html lang="en"><body><p>A greeting: <span lang="hi">नमस्ते</span></p></body></html>
Understanding the behavior
Language information helps screen readers, translation tools and other language-sensitive processing. Choose a valid language tag that describes the actual text. It is not a character encoding setting and does not translate the content.
Practical implementation notes
When a passage uses another language, place an appropriate lang attribute on that passage. Keep the root language accurate even if the interface contains a short quotation in another language.
How to check it
Inspect the root language and the span language separately with accessibility tools.
Expected result
The document declares English while the greeting is marked as Hindi.
Watch out: Use a language tag, not a country name.
Read the reference ↗