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

View in English Always switch to English

Intl.PluralRules.selectRange()

Baseline 2023
Newly available

Since August 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

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

ブラウザーの互換性

関連情報