diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-11 19:00:14 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-11 19:00:14 -0500 |
commit | ba5d6f9610d6bb352eecfa3ded1bb99bc9892916 (patch) | |
tree | 4ca1fd3d01433b96fce40c473a3b6b272be393eb /files/ja/web/javascript/reference/global_objects/intl | |
parent | d192fb918b0e2aa8869de6dcc59de8464b6e879a (diff) | |
download | translated-content-ba5d6f9610d6bb352eecfa3ded1bb99bc9892916.tar.gz translated-content-ba5d6f9610d6bb352eecfa3ded1bb99bc9892916.tar.bz2 translated-content-ba5d6f9610d6bb352eecfa3ded1bb99bc9892916.zip |
dump 2020-12-11
Diffstat (limited to 'files/ja/web/javascript/reference/global_objects/intl')
3 files changed, 255 insertions, 0 deletions
diff --git a/files/ja/web/javascript/reference/global_objects/intl/listformat/format/index.html b/files/ja/web/javascript/reference/global_objects/intl/listformat/format/index.html new file mode 100644 index 0000000000..6e2b3436e6 --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/intl/listformat/format/index.html @@ -0,0 +1,81 @@ +--- +title: Intl.ListFormat.prototype.format() +slug: Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/format +tags: + - Internationalization + - Intl + - JavaScript + - ListFormat + - Method + - Prototype +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/format +--- +<div>{{JSRef}}</div> + +<p><strong><code>format()</code></strong> メソッドは、リストの言語固有の表現を文字列で返します。</p> + +<div>{{EmbedInteractiveExample("pages/js/intl-listformat.html", "taller")}}</div> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox notranslate"><var>listFormat</var>.format([<var>list</var>])</pre> + +<h3 id="Parameters" name="Parameters">引数</h3> + +<dl> + <dt><code><var>list</var></code></dt> + <dd>Array などの反復可能オブジェクトです。</dd> +</dl> + +<h3 id="Return_value" name="Return_value">返値</h3> + +<p>リストのすべての要素を表現する、言語に依存した文字列表現です。</p> + +<h2 id="Description" name="Description">解説</h2> + +<p><strong><code>format()</code></strong> メソッドは、 <code>Intl.ListFormat</code> オブジェクトで提供された引数に基づいて書式化された文字列を返します。 <code>locales</code> と <code>options</code> 引数で <code>format()</code> の動作をカスタマイズし、アプリケーションがリストを書式化する言語の慣習を指定することができます。</p> + +<h2 id="Examples" name="Examples">例</h2> + +<h3 id="Using_format" name="Using_format">format の使用</h3> + +<p>以下の例では、英語を使用したリストのフォーマッターの作り方を紹介します。</p> + +<pre class="brush: js notranslate">const list = ['Motorcycle', 'Bus', 'Car']; + + console.log(new Intl.ListFormat('en-GB', { style: 'long', type: 'conjunction' }).format(list)); +// > Motorcycle, Bus and Car + + console.log(new Intl.ListFormat('en-GB', { style: 'short', type: 'disjunction' }).format(list)); +// > Motorcycle, Bus or Car + + console.log(new Intl.ListFormat('en-GB', { style: 'narrow', type: 'unit' }).format(list)); +// > Motorcycle Bus Car +</pre> + +<h2 id="Specifications" name="Specifications">仕様書</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">仕様書</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('Intl.ListFormat', '#sec-Intl.ListFormat.prototype.format', 'format()')}}</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> + +<p>{{Compat("javascript.builtins.Intl.ListFormat.format")}}</p> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li>{{jsxref("ListFormat", "Intl.ListFormat")}}</li> +</ul> diff --git a/files/ja/web/javascript/reference/global_objects/intl/listformat/listformat/index.html b/files/ja/web/javascript/reference/global_objects/intl/listformat/listformat/index.html new file mode 100644 index 0000000000..dd6aab0010 --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/intl/listformat/listformat/index.html @@ -0,0 +1,90 @@ +--- +title: Intl.ListFormat() コンストラクター +slug: Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat +tags: + - Constructor + - Intl + - JavaScript + - ListFormat + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/ListFormat +--- +<div>{{JSRef}}</div> + +<p>The <strong><code>Intl.ListFormat()</code></strong> コンストラクターは、言語に応じたリストの書式化を可能にするオブジェクトを生成します。</p> + +<div>{{EmbedInteractiveExample("pages/js/intl-listformat.html", "taller")}}</div> + +<div class="hidden">このデモのソースファイルは GitHub リポジトリに格納されています。デモプロジェクトに協力していただける場合は、 <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> をクローンしてプルリクエストを送信してください。</div> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="notranslate">new Intl.ListFormat([<var>locales</var>[, <var>options</var>]])</pre> + +<h3 id="Parameters" name="Parameters">引数</h3> + +<dl> + <dt><code><var>locales</var></code> {{optional_inline}}</dt> + <dd> + <p>BCP47 言語タグの文字列、または、そのような文字列の配列です。<code><var>locales</var></code> 引数の一般的な形式と解釈は、 {{jsxref("Global_Objects/Intl", "Intl", "#Locale_identification_and_negotiation", 1)}} のページをご覧ください。</p> + </dd> + <dt><code><var>options</var></code> {{optional_inline}}</dt> + <dd> + <p>以下のプロパティの一部またはすべてを持つオブジェクトです。</p> + + <dl> + <dt><code>localeMatcher</code></dt> + <dd>使用するロケール一致アルゴリズム。利用可能な値は <code>lookup</code> と <code>best fit</code> です。既定値は <code>best fit</code> です。このオプションについての詳細は、 {{jsxref("Global_Objects/Intl", "Intl のページ", "#Locale_negotiation", 1)}}をご覧ください。</dd> + <dt><code>type</code></dt> + <dd>出力メッセージの書式です。可能な値は "and" ベースのリストを表す <code>conjunction</code> (既定値、例えば <code>A, B, and C</code>)、または "or" ベースのリストを表す <code>disjunction</code> (例えば <code>A, B, or C</code>)、単位付きの値のリストを表す <code>unit</code> (例えば <code>5 pounds, 12 ounces</code>) です。</dd> + <dt><code>style</code></dt> + <dd>書式化されたメッセージの長さです。利用可能な値は、 <code>long</code> (既定値、例えば <code>A, B, and C</code>)、 <code>short</code> (例えば <code>A, B, C</code>)、 <code>narrow</code> (例えば <code>A B C</code>) です。 <code>style</code> が <code>short</code> または <code>narrow</code> であった場合、 type オプションには <code>unit</code> のみが許可されます。</dd> + </dl> + </dd> +</dl> + +<h2 id="Examples" name="Examples">例</h2> + +<h3 id="Using_format" name="Using_format">format の使用</h3> + +<p>次の例では、英語を使用するリストのフォーマッターを生成する方法を示します。</p> + +<pre class="brush: js notranslate">const list = ['Motorcycle', 'Bus', 'Car']; + + console.log(new Intl.ListFormat('en-GB', { style: 'long', type: 'conjunction' }).format(list)); +// > Motorcycle, Bus and Car + + console.log(new Intl.ListFormat('en-GB', { style: 'short', type: 'disjunction' }).format(list)); +// > Motorcycle, Bus or Car + + console.log(new Intl.ListFormat('en-GB', { style: 'narrow', type: 'unit' }).format(list)); +// > Motorcycle Bus Car</pre> + +<h2 id="Specifications" name="Specifications">仕様書</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">仕様書</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('Intl.ListFormat', '#sec-intl-listformat-constructor', 'ListFormat()')}}</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2> + +<div> +<div class="hidden">このページの互換性一覧表は構造化データから生成されています。データに協力していただけるのであれば、 <a class="external" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> をチェックアウトしてプルリクエストを送信してください。</div> + +<p>{{Compat("javascript.builtins.Intl.ListFormat.ListFormat")}}</p> +</div> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li>{{jsxref("Intl")}}</li> +</ul> diff --git a/files/ja/web/javascript/reference/global_objects/intl/listformat/supportedlocalesof/index.html b/files/ja/web/javascript/reference/global_objects/intl/listformat/supportedlocalesof/index.html new file mode 100644 index 0000000000..61ef765440 --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/intl/listformat/supportedlocalesof/index.html @@ -0,0 +1,84 @@ +--- +title: Intl.ListFormat.supportedLocalesOf() +slug: Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/supportedLocalesOf +tags: + - Internationalization + - Intl + - JavaScript + - ListFormat + - Method + - supportedLocalesOf +translation_of: Web/JavaScript/Reference/Global_Objects/Intl/ListFormat/supportedLocalesOf +--- +<p>{{JSRef}}</p> + +<p><strong><code>Intl.ListFormat.supportedLocalesOf()</code></strong> メソッドは、ランタイムの既定のロケールで代替する必要なく日時の書式で対応されているものを含む配列を返します。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox notranslate">Intl.ListFormat.supportedLocalesOf(<var>locales</var>[, <var>options</var>])</pre> + +<h3 id="Parameters" name="Parameters">引数</h3> + +<dl> + <dt><code><var>locales</var></code></dt> + <dd>BCP 47 言語タグを持つ文字列、またはそのような文字列の配列です。 <code>locales</code> 引数の一般的な形式については、 {{jsxref("Intl", "Intl のページ", "#Locale_identification_and_negotiation", 1)}}を参照してください。</dd> + <dt><code><var>options</var></code></dt> + <dd> + <p>省略可能です。以下のプロパティを持つことがあるオブジェクトです。</p> + + <dl> + <dt><code>localeMatcher</code></dt> + <dd>使用するロケールの一致アルゴリズムです。指定可能な値は <code>lookup</code> および <code>best fit</code> で、既定値は <code>best fit</code> です。このオプションの詳細は、 {{jsxref("Intl", "Intl のページ", "#Locale_negotiation", 1)}}を参照してください。</dd> + </dl> + </dd> +</dl> + +<h3 id="Return_value" name="Return_value">返値</h3> + +<p>指定したロケールタグのサブセットを表す文字列の配列で、ランタイムの既定のロケールで代替する必要なく日時の書式で対応されているものを含みます。</p> + +<h2 id="Description" name="Description">解説</h2> + +<p><code>locales</code> で提供されている言語タグのサブセットを含む配列を返します。返される言語タグは、ランタイムが日時のロケールに対応しているもので、使用しているロケール一致アルゴリズムで一致しているとみなされているものです。</p> + +<h2 id="Examples" name="Examples">例</h2> + +<h3 id="Using_supportedLocalesOf" name="Using_supportedLocalesOf">supportedLocalesOf() の使用</h3> + +<p>日時の書式でインドネシア語とドイツ語に対応しており、バリ語に対応していないランタイムを想定すると、 <code>supportedLocalesOf</code> はインドネシア語とドイツ語の言語タグを変更せずに返しますが、 pinyin の照合は日時の書式には関係なく、インドネシア語でも使用されません。ここでの <code>lookup</code> アルゴリズムの仕様に注意してください — バリ語話者のほとんどはインドネシア語も理解しているので、 <code>best fit</code> のマッチャーはインドネシア語がバリ語に適切に一致すると判断し、バリ語の言語タグも返すかもしれません。</p> + +<pre class="brush: js notranslate">const locales = ['ban', 'id-u-co-pinyin', 'de-ID']; +const options = { localeMatcher: 'lookup' }; +console.log(Intl.ListFormat.supportedLocalesOf(locales, options).join(', ')); +// → "id-u-co-pinyin, de-ID" +</pre> + +<h2 id="Specifications" name="Specifications">仕様書</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">仕様書</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('Intl.ListFormat', '#sec-Intl.ListFormat.supportedLocalesOf', 'supportedLocalesOf()')}}</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2> + +<div> +<div class="hidden">このページの互換性一覧表は構造化データから生成されています。データに協力していただけるのであれば、 <a class="external" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> をチェックアウトしてプルリクエストを送信してください。</div> + +<p>{{Compat("javascript.builtins.Intl.ListFormat.supportedLocalesOf")}}</p> +</div> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li>{{jsxref("ListFormat", "Intl.ListFormat")}}</li> +</ul> |