blob: df886d594dc6927a7628b72bfb9cb3a02aab0e87 (
plain)
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
|
---
title: Intl.Locale.prototype.script
slug: Web/JavaScript/Reference/Global_Objects/Intl/Locale/script
tags:
- Internationalization
- Intl
- JavaScript
- Property
- Prototype
- Reference
- プロパティ
- 国際化
translation_of: Web/JavaScript/Reference/Global_Objects/Intl/Locale/script
---
<div>{{JSRef}}</div>
<p><span class="seoSummary"><strong><code>Intl.Locale.prototype.script</code></strong> プロパティは、ロケールで使われている特定の言語を書くための文字体系を返すアクセサープロパティです。</span></p>
<h2 id="Description" name="Description">解説</h2>
<p>文字体系は、用字系と呼ばれることもありますが、ロケールの核となる属性の一つです。これは、特定の言語を書くために使用される記号やグリフの集合を示しています。例えば、英語の文字はラテン文字ですが、韓国語の文字はハングルです。多くの場合、言語 (これは必須) は単一の文字体系でしか書かれないので、文字体系を記述することは厳密には必要ありません。この規則には例外があり、完全な Unicode 言語識別子を持つためには、可能な限りスクリプトを示すことが重要です。</p>
<h2 id="Examples" name="Examples">例</h2>
<h3 id="Setting_the_script_in_the_locale_identifier_string_argument" name="Setting_the_script_in_the_locale_identifier_string_argument">ロケール識別子の文字列引数で文字体系を設定</h3>
<p>文字体系は、有効な Unicode 言語識別子文字列の2番目の部分であり、これを {{jsxref("Locale/Locale", "Locale")}} コンストラクターに渡すロケール識別子文字列に追加することで設定することができます。なお、文字体系はロケール識別子の必須項目ではありません。</p>
<pre class="brush: js">let scriptStr = new Intl.Locale("en-Latn-US");
console.log(scriptStr.script); // "Latn" と表示</pre>
<h3 id="Setting_the_script_via_the_configuration_object" name="Setting_the_script_via_the_configuration_object">構成オブジェクトから文字体系を設定</h3>
<p>{{jsxref("Locale/Locale", "Locale")}} コンストラクターは構成オブジェクトを取り、これを用いて文字体系のサブタグとプロパティを設定することができます。</p>
<pre class="brush: js">let scriptObj = new Intl.Locale("ja-JP", {script: "Jpan"});
console.log(scriptObj.script); // "Jpan" と表示</pre>
<h2 id="Specifications" name="Specifications">仕様書</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">仕様書</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('ES Int Draft', '#sec-Intl.Locale.prototype.script')}}</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>
<div>{{Compat("javascript.builtins.Intl.Locale.script")}}</div>
<h2 id="See_also" name="See_also">関連情報</h2>
<ul>
<li>{{jsxref("Locale", "Intl.Locale")}}</li>
<li><a href="https://www.unicode.org/reports/tr35/#unicode_script_subtag_validity">Unicode's script subtag specification</a></li>
</ul>
|