Do I need the “lang”-tag for Chrome translation?

2019-09-19 19:32发布

do I need the <html lang="de-DE">-tag for the Chrome translation? Or does Chrome also analyze the words used in the body-part to check in which language the page was written?

Or do I need to add the <html lang="de-DE">-tags at divs at the site?

An what when I use more than one language?

1条回答
甜甜的少女心
2楼-- · 2019-09-19 19:57

The Chrome browser can identify the page language by looking at a number of factors:

1.the character encoding.
2.the HTTP headers.
3.the encoding meta tag.
4.Analysis of the actual characters or words on the page.

So yes you need <html lang="de-DE">-tag.

If you want to use multiple languages for some content u can use elements such as span or div around the content. Here is an example:

<p>If you want to wish hello to someone in hindi.You would say <span lang="hi"> नमस्ते </span>. Namaste</p>
查看更多
登录 后发表回答