# Html lang attribute wrong value when using "set locale from accept language header"

**URL:** https://meta.discourse.org/t/html-lang-attribute-wrong-value-when-using-set-locale-from-accept-language-header/174603
**Category:** Bug
**Created:** [December 30, 2020, 2:18pm UTC](https://meta.discourse.org/t/html-lang-attribute-wrong-value-when-using-set-locale-from-accept-language-header/174603 "2020-12-30T14:18:26Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![guidoleenders](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/guidoleenders/32/196268_2.png) [@guidoleenders](https://meta.discourse.org/u/guidoleenders)
#### Post date: [December 30, 2020, 2:18pm UTC](https://meta.discourse.org/t/html-lang-attribute-wrong-value-when-using-set-locale-from-accept-language-header/174603/1 "2020-12-30T14:18:26Z")

</div>

We are trying to list some of our products on AppSource of Microsoft. They require an all English experience for listing. However, our forums are bilingual and I want to include a link to the English category on the AppSource listing.

We have enabled “set locale from accept language header” to allow people from India to see the secondary content in English (“Last topics” instead of “Laatste nieuwsberichten” - Dutch).

However, when testing with Postman and Accept-Language switching from “nl” to “en”, the generated HTML is incorrect:

With `en`:

```html
<!DOCTYPE html>
<html lang="nl">

<head>

```

With `nl`:

```html
<!DOCTYPE html>
<html lang="nl">

<head>

```

The actual labels are correctly changed from Dutch to English, but the html tag still lists the language as Dutch instead of the language of the content.

A test was also run from [Locale-Adaptive Pages Testing Tool | TechnicalSEO.com](https://technicalseo.com/tools/locale-adaptive/) with identical outcome:

 ![image](https://global.discourse-cdn.com/meta/original/3X/3/6/366386f6ae8e6eb9a1cd1ba9174b19cd2dd1844d.png)

It would be good for indexability when the lang attribute could be set either from the accept-language or derived from the category for Google. Please remember that Google crawls from US typically with Accept-Language set.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [December 30, 2020, 9:38pm UTC](https://meta.discourse.org/t/html-lang-attribute-wrong-value-when-using-set-locale-from-accept-language-header/174603/2 "2020-12-30T21:38:57Z")

</div>

Just to be clear, is the issue that you are describing only happening with crawlers and API requests?

From [Google’s documentation](https://developers.google.com/search/docs/advanced/crawling/locale-adaptive-pages?visit_id=637449604048193203-1470502211&rd=1):

> In addition, the crawler sends HTTP requests without setting `Accept-Language` in the request header.

Since Google doesn’t set the `Accept-Language` header, that approach isn’t going to work to solve the issue with Google.

> [@guidoleenders](#):
>
> However, when testing with Postman and Accept-Language switching from “nl” to “en”, the generated HTML is incorrect:

> [@guidoleenders](#):
>
> The actual labels are correctly changed from Dutch to English, but the html tag still lists the language as Dutch instead of the language of the content.

The `html` tag’s lang attribute is always set to the site’s default locale. This is also the case when a user selects a locale other than the site’s default locale from their preferences page.

---

<div class="post-metadata">

### Author: ![guidoleenders](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/guidoleenders/32/196268_2.png) [@guidoleenders](https://meta.discourse.org/u/guidoleenders)
#### Post date: [December 30, 2020, 9:41pm UTC](https://meta.discourse.org/t/html-lang-attribute-wrong-value-when-using-set-locale-from-accept-language-header/174603/3 "2020-12-30T21:41:07Z")

</div>

I am sorry. Maybe I pasted the wrong URL. See [Crawling and indexing of locale-adaptive pages &nbsp;|&nbsp; Google Search Central Blog &nbsp;|&nbsp; Google for Developers](https://developers.google.com/search/blog/2015/01/crawling-and-indexing-of-locale)

Since 2015 Google supports crawling with accept language.
