diff options
| author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
|---|---|---|
| committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
| commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
| tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/javascript/reference/global_objects/intl/locale/numeric | |
| parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
| download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip | |
initial commit
Diffstat (limited to 'files/ja/web/javascript/reference/global_objects/intl/locale/numeric')
| -rw-r--r-- | files/ja/web/javascript/reference/global_objects/intl/locale/numeric/index.html | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/files/ja/web/javascript/reference/global_objects/intl/locale/numeric/index.html b/files/ja/web/javascript/reference/global_objects/intl/locale/numeric/index.html new file mode 100644 index 0000000000..f60bc08e48 --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/intl/locale/numeric/index.html @@ -0,0 +1,65 @@ +--- +title: Intl.Locale.prototype.numeric +slug: Web/JavaScript/Reference/Global_Objects/Intl/Locale/numeric +tags: + - Internationalization + - Intl + - JavaScript + - Property + - Prototype + - Reference + - プロパティ + - 国際化 +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/Locale/numeric +--- +<div>{{JSRef}}</div> + +<p><span class="seoSummary"><strong><code>Intl.Locale.prototype.numeric</code></strong> プロパティは、ロケールが特別な数字の照合処理を行うかどうかを返すアクセサプロパティです。</span></p> + +<h2 id="Description" name="Description">解説</h2> + +<p>{{jsxref("Locale.caseFirst", "Intl.Locale.caseFirst")}} と同様、 <code>numeric</code> はロケールが使用する照合規則を変更するものです。 <code>numeric</code> は {{jsxref("boolean", "Boolean")}} 値で、 <code>true</code> か <code>false</code> のどちらかになります。 <code>numeric</code> を <code>false</code> に設定した場合は、文字列内の数値を特別に扱うことはありません。 <code>numeric</code> を <code>true</code> に設定した場合は、ロケールは文字列を照合する際に数値を考慮します。この数値の特別な扱いとは、数字の並びを数値として比較するということです。例えば、 "A-21" という文字列は "A-123" よりも小さいとみなされます。</p> + +<h2 id="Examples" name="Examples">例</h2> + +<h3 id="Setting_the_numeric_value_via_the_locale_string" name="Setting_the_numeric_value_via_the_locale_string">ロケール文字列から <code>numeric</code> の値を設定</h3> + +<p><a href="https://www.unicode.org/reports/tr35/" rel="noopener">Unicode ロケール文字列仕様書</a>では、 <code>numeric</code> が表す値はキー <code>kn</code> に対応しています。 <code>kn</code> はロケール文字列の「拡張サブタグ」とみなされます。これらのサブタグは、ロケールに関する追加データを追加するもので、拡張キー <code>-u</code> を使用してロケール識別子に追加されます。このようして、 <code>numeric</code> の値を {{jsxref("Locale/Locale", "Locale")}} コンストラクターに渡される初期のロケール識別子文字列に追加することができます。 <code>numeric</code> の値を設定するには、まず文字列に <code>-u</code> 拡張キーを追加します。次に、 <code>-kn</code> 拡張キーを追加して、 <code>numeric</code> の値を追加していることを示します。最後に、文字列に <code>numeric</code> の値を追加します。 <code>numeric</code> を <code>true</code> に設定したい場合は、単に <code>kn</code> キーを追加するだけで十分です。値を <code>false</code> にするには、 <code>kn</code> キーの後に "<code>false</code>" を指定する必要があります。</p> + +<pre class="brush: js">let numericViaStr = new Intl.Locale("fr-Latn-FR-u-kn-false"); +console.log(numericStr.numeric); // "false" と表示</pre> + +<h3 id="Setting_the_numeric_value_via_the_configuration_object_argument" name="Setting_the_numeric_value_via_the_configuration_object_argument">構成オブジェクト引数から <code>numeric</code> の値を設定</h3> + +<p>{{jsxref("Locale/Locale", "Intl.Locale")}} コンストラクターには、オプションで構成オブジェクトの引数があり、これを使用して拡張の種類を渡すことができます。構成オブジェクトの <code>numeric</code> プロパティを任意の <code>numeric</code> に設定し、コンストラクターに渡します。</p> + +<pre class="brush: js">let numericViaObj= new Intl.Locale("en-Latn-US", {numeric: true}); +console.log(us12hour.numeric); // "true" と表示 +</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.numeric')}}</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2> + +<div class="hidden">このページの互換性一覧表は構造化データから生成されています。データに協力していただけるのであれば、 <a class="external" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> をチェックアウトしてプルリクエストを送信してください。</div> + +<div>{{Compat("javascript.builtins.Intl.Locale.numeric")}}</div> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li>{{jsxref("Locale", "Intl.Locale")}}</li> +</ul> |
