Intl.PluralRules

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.

* Some parts of this feature may have varying levels of support.

Intl.PluralRules オブジェクトは、複数形が影響する書式や言語ルールを使用できるようにします。

コンストラクター

Intl.PluralRules()

新しい Intl.PluralRules オブジェクトを生成します。

静的メソッド

Intl.PluralRules.supportedLocalesOf()

指定したロケールのうち、ランタイムの既定のロケールに代替されることなく対応されているものが入った配列を返します。

インスタンスメソッド

Intl.PluralRules.prototype.resolvedOptions()

オブジェクトの初期化中に計算されたロケールとコレクションのオプションを反映したプロパティを持った新しいオブジェクトを返します。

Intl.PluralRules.prototype.select()

ロケールを考慮した書式化に使用する複数形を示す文字列を返します。

Intl.PluralRules.prototype.selectRange()

このメソッドは 2 つの値を受け取り、ロケールを考慮した書式化に使用する複数形を示す文字列を返します。

locales の使用

この例では、ローカライズされた複数形ルールのいくつかを表示します。アプリケーションのユーザーインターフェイスで使う言語の書式を取得するには、 locales 引数に言語(および必要に応じて代替言語)を指定してください。

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
# pluralrules-objects

ブラウザーの互換性

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
PluralRules
PluralRules() constructor
options parameter
options.roundingIncrement parameter
options.roundingMode parameter
options.roundingPriority parameter
options.trailingZeroDisplay parameter
Experimental
resolvedOptions
select
selectRange
supportedLocalesOf

Legend

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

Full support
Full support
Partial support
Partial support
No support
No support
Experimental. Expect behavior to change in the future.
See implementation notes.
Has more compatibility info.

関連情報