[3] [[実体]]の[[言語]]を指定する[[頭欄]]です。元々 RFC 1766 で定義されていましたが、2002年5月末に新しい RFC 3282 により再定義されました。 - [8] [[HTTP]] も別途定義しています。 [[#comment]] * ABNF - [4] Content-Language = "Content-Language" ":" [CFWS] Language-List - [5] Language-List = Language-Tag [CFWS] *("," [CFWS] Language-Tag [CFWS]) - [6] obs-content-language = "Content-Language" *WSP ":" [CFWS] Language-List (RFC 1766 および RFC 3282 より作成) [7] [VAR(ABNF)[language-tag]] は、 [[BCP]] 47 / [[RFC3066]] が定義しています。 (See [[言語札]]) [[#comment]] ** 仕様書から ** RFC 1945 (HTTP/1.0) D.2.5; (HTTP/1.1) RFC 2068 14.13; RFC 2616 14.12 Content-Language > The Content-Language entity-header field describes the natural language(s) of the intended audience for the enclosed entity. Note that this [DEL[[INS[{1945,2068}]] may]] [INS[[INS[{2616}]] might]] not be equivalent to all the languages used within the entity[INS[-body [INS[{2068,2616}]]]]. [CODE(HTTP)[Content-Language]] 実体頭欄は、 囲まれた実体の想定視聴者の自然言語を記述します。 これは [CODE(ABNF)[[[entity-body]]]] 中で使われている全ての言語と等しくないかもしれないことに注意して下さい。 [INS[ > [INS[{2068,2616}]] - Content-Language = "Content-Language" ":" 1#language-tag > Language tags are defined in section 3.10. The primary purpose of Content-Language is to allow a user to identify and differentiate entities according to the user's own preferred language. Thus, if the body content is intended only for a Danish-literate audience, the appropriate field is [[言語札]]は 3.10 節で定義しています。 [CODE(HTTP)[Content-Language]] の主たる区的は、利用者が利用者自身の優先言語に従って実態を識別・差別化することを可能とすることにあります。 従って、本体内容がデンマーク語が分かる視聴者のみを想定しているのであれば、 適切な欄は > - Content-Language: da > If no Content-Language is specified, the default is that the content is intended for all language audiences. This [DEL[may]] [INS[might]] mean that the sender does not consider it to be specific to any natural language, or that the sender does not know for which language it is intended. [CODE(HTTP)[Content-Language]] が指定されていなければ、既定値はその内容がすべての言語の視聴者を想定しているになります。 これは、送信者がそれが何らかの自然言語に特有のものであると考えていないか、 送信者がどの言語が想定されているのか知らないことを意味するでしょう。 > Multiple languages MAY be listed for content that is intended for multiple audiences. For example, a rendition of the "Treaty of Waitangi," presented simultaneously in the original Maori and English versions, would call for 複数の視聴者を想定している内容については、複数の言語を列挙しても'''構いません'''。 例えば、 [SAMP[Treaty of Waitangi]] の翻訳で、 元のマオリ版と英語版が並行して示されているなら、 > - Content-Language: mi, en となるでしょう。 > However, just because multiple languages are present within an entity does not mean that it is intended for multiple linguistic audiences. An example would be a beginner's language primer, such as "A First Lesson in Latin," which is clearly intended to be used by an English-literate audience. In this case, the Content-Language [DEL[should]] [INS[would properly]] only include "en". しかし、ただ単に実体中に複数の言語が示されていることは複数の言語の視聴者を想定していることを意味しません。 例えば、初めての言語入門書, 例えば『A First Lesson in Latin』のような明らかに英語の分かる視聴者に使われることを意図したものを考えましょう。 この場合だと、 [CODE(HTTP)[Content-Language]] は [CODE(lang)[en]] だけを含めるのが適当でしょう。 > Content-Language [DEL[may]] [INS[MAY]] be applied to any media type -- it is not limited to textual documents. [CODE(HTTP)[Content-Language]] はどの媒体型に適用しても'''かまいません'''。 文的文書には制限しません。 ]INS] ** RFC の部分の License [[RFCのライセンス]] * See also - [1] [[RFC1766]] - [2] [[RFC3282]] * メモ - [9] [WEAK[2002-11-16 (土) 19:06]] ''[[名無しさん]]'': 関連して[[内容折衝]]に使われる対応する欄として、 [[Accept-Language:欄]]があります。 - [10] [WEAK[2002-11-16 (土) 19:08]] ''[[名無しさん]]'': 言語情報は転送[[プロトコル]]層に使われるこの欄ではなく、より上の層で記述されることもあります。 (例えば [[HTML]] の [[lang属性]]や [[XML]] の [[xml:lang属性]], あるいは [[Unicode]] の[[14面言語タグ]], [[ファイル名]]の一部など。) どれを使うのが適切かは、その場面によるでしょう。 - [11] >>10 [[言語情報]] - [12] この欄って使われてるのかなあ? MIME にしろ HTTP にしろ有意義に使われてるのって見たことなくない? - [13] 欄自体は、 MIME ではたまにしか見ないけど、 HTTP では [[Apache]] とかで内容折衝に使う関係で、ちゃんと設定されてることも少なくないよね。情報提供側はまあまあいけてるけど、実際に応用側ではどうだろう。。。 * [CODE(HTML)@en[]] ** 不思議解釈 [14] よく、 [[HTML文書]]に [CODE(HTML deprecated example)@en[<[[meta]] [[http-equiv]]="[[Content-Language]]" [[content]]="[[ja]]">]] のように[[言語]]を指定すれば[[文字化け]]しなくなるなどと適当な解説がされていますが、'''まったく意味がありません'''。 [CODE(HTMLa)@en[[[http-equiv]]]] は本来[[鯖]]が解釈するものでしたが、 そうするように設定されている[[鯖]]はほとんどありません。 [[Webブラウザ]]が解釈することもありますが、 保障されているわけではありませんでした。 ''本当の'' [[HTTP]] [[頭欄]]としての [CODE(HTTP)@en[[[Content-Language]]:]] を指定するか、 [[HTML]] の[[要素]]に [CODE(HTMLa)@en[[[lang]]]] を指定するのが適切なやり方です。 ;; いずれにしても、[[文字コード]]とはまったく関係ありません。 [[文字化け]]がなくなるなどと解説している[[文書]]は信用してはいけません。 **歴史 [15] [CITE@en[]] ([[Ian Hickson]] 著, [TIME[2008-12-02 16:05:28 +09:00]] 版) [CODE(HTML)@en[]] は不適合になりました。 [16] [CITE@en[(X)HTML5 Tracking]] ([TIME[2009-10-27 22:21:31 +09:00]] 版)