1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
---
title: Content-Language
slug: Web/HTTP/Headers/Content-Language
tags:
- HTTP
- Headers
- Reference
translation_of: Web/HTTP/Headers/Content-Language
---
<p>{{HTTPSidebar}}</p>
<p><strong><code>Content-Language</code></strong> は {{Glossary("entity header", "エンティティヘッダー")}} で、ユーザが自分の好みの言語に応じて区別できるように、オーディエンス向けの言語を記述するために使用されます。</p>
<p>たとえば、"<code>Content-Language: de-DE</code>" が設定されている場合、その文書はドイツ語のスピーカーを対象としてます (ただし、文書がドイツ語で記述されていることを示すわけではありません。 たとえば、ドイツ語スピーカーのための語学コースの一部としての英語が書かれているかもしれません。文書が記述されている言語を示す場合は、代わりに <a href="/ja/docs/Web/HTML/Global_attributes/lang"><code>lang</code> 属性</a>を使用します)。</p>
<p><code>Content-Language</code> が指定されていない場合、既定ではコンテンツがすべての言語のオーディエンスを対象としています。<code>Content-Language</code> ヘッダーをテキスト形式の文書やさまざまな種類のメディアに適用するだけでなく、複数の言語タグを使用することもできます。</p>
<table class="properties">
<tbody>
<tr>
<th scope="row">ヘッダー種別</th>
<td>{{Glossary("Entity header", "エンティティヘッダー")}}</td>
</tr>
<tr>
<th scope="row">{{Glossary("Forbidden header name", "禁止ヘッダー名")}}</th>
<td>いいえ</td>
</tr>
<tr>
<th scope="row">{{Glossary("CORS-safelisted response header", "CORS セーフリストレスポンスヘッダー")}}</th>
<td>はい</td>
</tr>
<tr>
<th scope="row">{{Glossary("CORS-safelisted request header", "CORS セーフリストリクエストヘッダー")}}</th>
<td>はい、値を <code>0-9</code>, <code>A-Z</code>, <code>a-z</code>, 空白、 <code>*,-.;=</code> のみに限定するという追加の制限があります。</td>
</tr>
</tbody>
</table>
<h2 id="Syntax" name="Syntax">構文</h2>
<pre class="syntaxbox notranslate">Content-Language: de-DE
Content-Language: en-US
Content-Language: de-DE, en-CA
</pre>
<h2 id="Directives" name="Directives">ディレクティブ</h2>
<dl>
<dt><code>language-tag</code></dt>
<dd>複数の言語タグはカンマで区切られています。各言語タグはハイフン文字 ("<code>-</code>", <code>%x2D</code>) で区切られた、大文字小文字を区別しない1つ以上のサブタグのシーケンスです。ほとんどの場合、言語タグは関連する言語の広いファミリを識別するプライマリ言語サブタグ (たとえば、"<code>en</code>" = 英語) で構成され、オプションとして、その言語の範囲を絞り込むか狭める一連のサブタグ ("<code>en-CA</code>" = カナダで伝達される英語の種類) が続きます。</dd>
</dl>
<div class="note">
<p><strong>メモ:</strong> 言語タグは、使用される<a href="https://en.wikipedia.org/wiki/Language_code">言語コード</a>の <a href="https://en.wikipedia.org/wiki/ISO_639">ISO 639</a> 規格 (<a href="https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes">ISO 639-1 のコードリスト</a>であることが多い) に依存する、<a href="https://tools.ietf.org/html/rfc5646">RFC 5646</a> でフォーマットが定義されています。</p>
</div>
<h2 id="Examples" name="Examples">例</h2>
<h3 id="Indicating_the_language_a_document_is_written_in" name="Indicating_the_language_a_document_is_written_in">文書が書かれている言語を示す</h3>
<p>グローバル <code><a href="/ja/docs/Web/HTML/Global_attributes/lang">lang</a></code> 属性は、HTML 要素全体またはその一部の言語を示すために HTML 要素で使用されます。</p>
<pre class="brush: html notranslate"><html lang="de"></pre>
<p>文書の言語を記述するために、このような meta 要素を以下のように使用<strong>しないで</strong>ください。</p>
<pre class="brush: html example-bad notranslate"><!-- /!\ This is bad practice -->
<meta http-equiv="content-language" content="de"></pre>
<h3 id="Indicating_a_target_audience_for_a_resource" name="Indicating_a_target_audience_for_a_resource">リソースのターゲットオーディエンスを示す</h3>
<p><code>Content-Language</code> ヘッダーは、<strong>ページの対象読者</strong>を指定するために使用され、複数の言語であることを示すことができます。</p>
<pre class="notranslate">Content-Language: de, en</pre>
<h2 id="Specifications" name="Specifications">仕様書</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">仕様書</th>
<th scope="col">題名</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{RFC("7231", "Content-Language", "3.1.3.2")}}</td>
<td>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>
<p>{{Compat("http.headers.Content-Language")}}</p>
<h2 id="See_also" name="See_also">関連情報</h2>
<ul>
<li>{{HTTPHeader("Accept-Language")}}</li>
<li><a href="https://www.w3.org/International/questions/qa-http-and-lang.en">HTTP headers, meta elements and language information</a></li>
<li><a href="/ja/docs/Web/HTML/Global_attributes/lang">HTML の <code>lang</code> 属性</a></li>
</ul>
|