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

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

From Google’s documentation:

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.

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.

2 Likes