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 September 2019.

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® 2025 Internationalization API Specification
# sec-intl.pluralrules.prototype.select

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
select

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
See implementation notes.

関連情報