--- title: Intl.PluralRules.select() slug: Web/JavaScript/Reference/Global_Objects/Intl/PluralRules/select tags: - Internationalization - Intl - JavaScript - Method - PluralRules - メソッド - 国際化 translation_of: Web/JavaScript/Reference/Global_Objects/Intl/PluralRules/select ---
{{JSRef}}

Intl.PluralRules.prototype.select メソッドは、ロケールを考慮した書式設定に使用する複数形ルールを示す String を返します。

構文

pluralCategory = pluralRule.select(number)

引数

number
複数のルールを取得するための数値です。

返値

数字の複数形のカテゴリを表す string で、 zero, one, two, few, many, other のいずれかになります。

解説

この関数は、 {{jsxref("PluralRules")}} オブジェクトのロケールや書式オプションに応じて、複数形のカテゴリを選択します。

select() の使用

 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'

仕様書

仕様書
{{SpecName('ES Int Draft', '#sec-intl.pluralrules.prototype.select', 'Intl.PluralRules.select()')}}

ブラウザーの互換性

{{Compat("javascript.builtins.Intl.PluralRules.select")}}

関連情報