Intl.PluralRules.selectRange()

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

構文

js
selectRange(startRange, endRange);

返値

数字の複数形のカテゴリーを表す文字列で、 zero, one, two, few, many, other のいずれかで、 LDML 言語複数ルールで指定されたローカライズのロケールに関連するものです。

解説

この関数は、 Intl.PluralRules オブジェクトのロケールおよび書式化オプションに従って、複数形カテゴリーを選択するものです。

selectRange() の使用

js
new Intl.PluralRules("sl").selectRange(102, 201);
// → 'few'

new Intl.PluralRules("pt").selectRange(102, 102);
// → 'other'

仕様書

Specification
ECMAScript® 2025 Internationalization API Specification
# sec-intl.pluralrules.prototype.selectrange

ブラウザーの互換性

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
selectRange

Legend

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

Full support
Full support
No support
No support

関連情報