Define multiple languages in html root element's lang attribute?

前端 未结 5 1014
执念已碎
执念已碎 2021-02-01 03:52

I want to determine more than one language for a document, because it\'s available in more than one language. If I use:



        
5条回答
  •  粉色の甜心
    2021-02-01 04:19

    All attributes support only one language, so I believe you should define only one language; the most important language should be set. This can't be done if you have multiple languages on a single document, so here is the info to solve your problem:

    The lang and xml:lang attributes do not allow you to assign multiple languages to a single document. So if you're writing a Web page with multiple languages you have two options:

    1. Define a primary language with the lang attribute, and then call out the secondary language(s) with lang attributes on elements in the document
    2. Define lang in the specific sections of the document as needed:

      Canadian French content...
      Canadian English content...
      Netherlands, Dutch content...

    I have some multiple-language pages and I do use the 2nd option.

    You might want to read http://www.w3.org/TR/2007/NOTE-i18n-html-tech-lang-20070412/#ri20060630.133619987

提交回复
热议问题