Intl.PluralRules.prototype.resolvedOptions() method returns a new object with properties reflecting the locale and plural formatting options computed during initialization of this PluralRules 对象。

句法

pluralRule.resolvedOptions()
					

返回值

A new object with properties reflecting the locale and plural formatting options computed during the initialization of the given PluralRules 对象。

描述

The resulting object has the following properties:

locale
The BCP 47 language tag for the locale actually used. If any Unicode extension values were requested in the input BCP 47 language tag that led to this locale, the key-value pairs that were requested and are supported for this locale are included in locale .
pluralCategories
Array of plural categories used by the given locale, seleced from the list "zero" , "one" , "two" , "few" , "many" and "other" .
type
The type used ( cardinal or ordinal ).

Only one of the following two groups of properties is included:

minimumIntegerDigits
minimumFractionDigits
maximumFractionDigits
The values provided for these properties in the options argument or filled in as defaults. These properties are present only if neither minimumSignificantDigits nor maximumSignificantDigits was provided in the options 自变量。
minimumSignificantDigits
maximumSignificantDigits
The values provided for these properties in the options argument or filled in as defaults. These properties are present only if at least one of them was provided in the options 自变量。

范例

使用 resolvedOptions 方法

var de = new Intl.PluralRules('de-DE');
var usedOptions = de.resolvedOptions();
usedOptions.locale;                // "de-DE"
usedOptions.maximumFractionDigits; // 3
usedOptions.minimumFractionDigits; // 0
usedOptions.minimumIntegerDigits;  // 1
usedOptions.pluralCategories;      // Array [ "one", "other" ]
usedOptions.type;                  // "cardinal"
						

规范

规范
ECMAScript 国际化 API (ECMA-402)
The definition of 'Intl.PluralRules.prototype.resolvedOptions' in that specification.

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
Desktop Mobile Server
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet Node.js
resolvedOptions Chrome 63 Edge 18 Firefox 58 IE No Opera 50 Safari 13 WebView Android 63 Chrome Android 63 Firefox Android 58 Opera Android 46 Safari iOS 13 Samsung Internet Android 8.0 nodejs 10.0.0
10.0.0
Before version 13.0.0, only the locale data for en-US is available by default. See the PluralRules() 构造函数 了解更多细节。

图例

完整支持

完整支持

不支持

不支持

见实现注意事项。

另请参阅

元数据

  • 最后修改: