--- title: Intl.PluralRules slug: Web/JavaScript/Reference/Global_Objects/Intl/PluralRules tags: - Class - Internationalization - Intl - JavaScript - PluralRules translation_of: Web/JavaScript/Reference/Global_Objects/Intl/PluralRules --- <div>{{JSRef}}</div> <p><strong><code>Intl.PluralRules</code></strong> オブジェクトは、複数形が影響する書式や言語ルールを使用できるようにします。</p> <h2 id="Constructor" name="Constructor">コンストラクター</h2> <dl> <dt>{{jsxref("PluralRules.PluralRules()", "Intl.PluralRules.PluralRules()")}}</dt> <dd>新しい <code>Intl.PluralRules</code> オブジェクトを生成します。</dd> </dl> <h2 id="Static_methods" name="Static_methods">静的メソッド</h2> <dl> <dt>{{jsxref("Intl/PluralRules/supportedLocalesOf", "Intl.PluralRules.supportedLocalesOf()")}}</dt> <dd>指定したロケールのうち、ランタイムの既定のロケールにフォールバックすることなく対応されているものが入った配列を返します。</dd> </dl> <h2 id="Instance_methods" name="Instance_methods">インスタンスメソッド</h2> <dl> <dt>{{jsxref("Intl/PluralRules/resolvedOptions", "Intl.PluralRules.prototype.resolvedOptions()")}}</dt> <dd>オブジェクトの初期化中に計算されたロケールとコレクションのオプションを反映したプロパティを持った新しいオブジェクトを返します。</dd> <dt>{{jsxref("Intl/PluralRules/select", "Intl.PluralRules.prototype.select()")}}</dt> <dd>ロケールを意識した書式化に使用する複数形を示す {{jsxref("String")}} を返します。</dd> </dl> <h2 id="Examples" name="Examples">例</h2> <h3 id="Using_locales" name="Using_locales">locales の使用</h3> <p>この例では、ローカライズされた複数形ルールのいくつかをお見せします。アプリケーションのユーザーインターフェイスで使う言語のフォーマットを取得するには、 <code>locales</code> 引数に言語 (および必要に応じてフォールバック言語) を指定してください。</p> <pre class="brush: js notranslate">// アラビア語は別な複数形の規則を持っています。 new Intl.PluralRules('ar-EG').select(0); // → 'zero' new Intl.PluralRules('ar-EG').select(1); // → 'one' new Intl.PluralRules('ar-EG').select(2); // → 'two' new Intl.PluralRules('ar-EG').select(6); // → 'few' new Intl.PluralRules('ar-EG').select(18); // → 'many' </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', '#pluralrules-objects', 'Intl.PluralRules')}}</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.PluralRules")}}</p> </div> <h2 id="See_also" name="See_also">関連情報</h2> <ul> <li>{{jsxref("Intl")}}</li> </ul>