LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 754|回复: 2

LANG attribute, Han unification, fonts, etc.

[复制链接]
发表于 2006-5-9 17:54:37 | 显示全部楼层 |阅读模式
http://www.mozilla.org/projects/intl/fonts.html

Another problem is Unicode's Han unification. Unicode uses one set of characters for Chinese, Japanese, Korean and other Han languages. How do we know which font to use if the document is in Unicode? One way is to use HTML's LANG attribute. If the attribute for a particular span of text says "ja", then we can use a Japanese font for that span.

  1. <html dir="ltr" lang="zh">
复制代码


摘自论坛页面代码,这个是一直存在的吧?

根据LANG的的值选择合适的字体,似乎是不错的办法,但Opera和Konqueror似乎都没有这么做。

LANG

The LANG attribute specifies the language of an element's attribute values and its content, including all contained elements that do not specify their own LANG attribute. While the LANG attribute is not widely supported, its use may help search engines index a document by its language while allowing speech synthesizers to use language-dependent pronunciation rules. As well, visual browsers can use the language's proper quotation marks when rendering the Q element.

The attribute value is case-insensitive, and should be specified according to RFC 1766; examples include en for English, en-US for American English, and ja for Japanese. Whitespace is not allowed in the language code.

Use of the LANG attribute also allows authors to easily change the style of text depending on the language. For example, a bilingual document may have one language in italics if rendered visually or a different voice if rendered aurally. The HTML of such a document might be as follows:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
   "http://www.w3.org/TR/REC-html40/strict.dtd">
<TITLE>Welcome - Bienvenue</TITLE>
<H1>
  <SPAN LANG=en>Welcome</SPAN> -
  <SPAN LANG=fr>Bienvenue</SPAN>
</H1>
< LANG=en>This paragraph is in English.</P>
< LANG=fr>Ce paragraphe est en français.</P>
...

A document's primary language may be set using the LANG attribute on the HTML element, or, alternatively, by using the Content-Language HTTP header.
 楼主| 发表于 2006-5-9 18:23:44 | 显示全部楼层
那么html/xml中没有指定lang怎么办,比如google,它是国际化的,不可能指定lang,这时页面中Han unification部分的字符该用哪种字体,应该根据locale?如果locale不是zh_*.UTF-8, ja_JP.UTF-8, ko_KR.UTF-8中的任何一种,而是如en_US.UTF-8,那么又该如何选择?(在假定样式表也没指定字体的情况下)
回复 支持 反对

使用道具 举报

发表于 2006-5-10 00:36:42 | 显示全部楼层
如果是en_US.utf8,可能会使用en_US
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表