このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。

View in English Always switch to English

Intl.PluralRules.select()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨2019年9月⁩.

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

試してみましょう

console.log(new Intl.PluralRules("ar-EG").select(0));
// Expected output: "zero"

console.log(new Intl.PluralRules("ar-EG").select(5));
// Expected output: "few"

console.log(new Intl.PluralRules("ar-EG").select(55));
// Expected output: "many"

console.log(new Intl.PluralRules("en").select(0));
// Expected output: "other"

構文

js
select(number);

引数

number

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

返値

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

解説

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

select() の使用

js
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'

仕様書

Specification
ECMAScript® 2026 Internationalization API Specification
# sec-intl.pluralrules.prototype.select

ブラウザーの互換性

関連情報