xhtml文档-Lang选项问题 [英] xhtml document - Lang options question

查看:84
本文介绍了xhtml文档-Lang选项问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面显示的两行之间有什么区别?

What is the difference between the 2 lines shown below?:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB">

<meta http-equiv="content-language" content="en-GB" />

如果我没有meta标签,会有什么后果?

If i didn't have the meta tag, what would be the consequence?

第1个元数据会影响屏幕阅读器,而排名前1位的读者不会吗?我对它们的作用有些困惑。

Does the meta one affect screen readers and the top one not? I'm a bit confused as to what exactly they do.

在此先感谢您的帮助

最好问候

跳过。

推荐答案

潜入可访问性的识别您的语言页面建议根据您的文档类型,尽可能多地添加以处理尽可能多的屏幕阅读器:

Dive Into Accessibility's Identifying your language page recommends adding as much as possible to handle as many screen readers as you can, depending on your doctype:


如果您使用HTML 4的任何变体,则
会将标签更改为此(使用您自己的语言
代码,如果不是
英语):

If you're using any variant of HTML 4, change your tag to this (use your own language code if not English):

< html lang = zh-CN>

如果您使用XHTML
1.0的任何变体,请将标签更改为此(在
的两个地方都使用语言代码):

If you're using any variant of XHTML 1.0, change your tag to this (use your language code in both places):

< html xmlns = http://www.w3.org/1999/xhtml lang = zh-CN xml:lang = zh-CN >

如果您使用的是XHTML 1.1,将您的
标记更改为此(再次插入
自己的语言代码):

If you're using XHTML 1.1, change your tag to this (again, insert your own language code):

< html xmlns = http://www.w3.org/1999/xhtml xml:lang = zh-CN>

同一篇文章还引用 ISO 639.2 来确定尽管XML规范引用了单独的文档,但xml:lang的值仍应为 RFC4646最佳现行做法-用于识别语言的标签,似乎表明您的 en-GB值是有效的。

The same article also references ISO 639.2 to determine what the value of xml:lang should be, although the XML specification references a separate document, RFC4646 Best Current Practice - Tags For Identifying Languages, which seems to indicate your value of "en-GB" is valid.

Google的网络创作统计(2005)可以这样说:

Google's Web Authoring Statistics (2005) have the following to say about it:


接下来是Content-Language值
(用于http-equiv属性)。
使用此功能的人几乎与
在html
元素上指定lang属性有关。在目前
的HTML5规范中,对于将
设置为字符编码的一种情况,只允许
使用http-equiv属性,如图所示,实际上不能删除

以上显示。但是,
http-equiv = Content-Language至少由一个浏览器支持
,而
如我们在此处看到的那样,被广泛使用-
也许是http-equiv

Next is the Content-Language value (used on the http-equiv attribute). Almost as many people use this as specify the lang attribute on the html element. In the HTML5 spec currently the http-equiv attribute is only allowed for the one case of setting the character encoding, which can't really be dropped, as the graph above demonstrates. However, http-equiv="Content-Language" is supported by at least one browser, and as we see here, it is widely used — maybe http-equiv should not be removed after all.

另外, webproworld上的线程讨论了使用http- equiv = content-language和name = language来描述文档的语言,并暗示两者都是必要的。

Further, a thread on webproworld talks about the difference between using http-equiv=content-language and name=language to describe the language of the document and implies that both are necessary.

最后,请参考 HTML技术用于Web内容可访问性指南1.0 ,以获取更多建议,特别是识别主要语言

Finally, refer to the HTML Techniques for Web Content Accessibility Guidelines 1.0 document at W3C for some more recommendations, specifically Identifying the Primary Language.

总结n似乎屏幕阅读器对语言属性的关注要比对内容语言元信息的关注多,但是我看到的大多数建议仍然建议使用元数据。尤其是Google的统计数据似乎很相关,因此也许您应该将两者都留在里面。

In conclusion it looks like screen readers are looking at lang attributes more than content-language meta information, but most recommendations I've seen advise using meta data anyway. Especially the Google statistics seem pertinent, so perhaps you should leave both in.

这篇关于xhtml文档-Lang选项问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆