Is 'en-EU' a valid value for HTML 'lang' attribute?

十年热恋 提交于 2019-12-18 13:15:54

问题


Markup for different editions of my news site...

  • US Edition:

    <html lang="en-US" xml:lang="en-US"> ... </html>
    
  • India Edition:

    <html lang="en-IN" xml:lang="en-IN"> ... </html>
    
  • Europe Edition (in this case not a specific country, i.e. news covers a broader region):

    <html lang="en-EU" xml:lang="en-EU"> ... </html>
    

I am depending on the markup of the page to make the target language/region of pages clear to the search engines because the different editions of the news site use a directory-based path (e.g. example.com/eu/) rather than a sub-domain (eu.example.com) or domain (e.g. example.eu) based path.

Now coming to the point, the lang attribute can have a value that is of the format language-region. But is en-EU a valid value?

PS: I think so, but I'd like to confirm with the knowledgeable folks here.

  • Based on: http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry

  • Via: http://www.w3.org/International/articles/language-tags/


回答1:


Why not?

  1. HTML5 (CR) defines that the "value must be a valid BCP 47 language tag, or the empty string".

  2. BCP 47 defines that the "IANA Language Subtag Registry […] contains a comprehensive list of all of the subtags valid in language tags".

  3. IANA Language Subtag Registry contains the subtag EU of type region.

It’s not up to anyone to formally define if or which linguistic variations are spoken in which regions. Language changes constantly, speakers live and die everywhere.



来源:https://stackoverflow.com/questions/20722488/is-en-eu-a-valid-value-for-html-lang-attribute

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!