?
u
/
The PluralRules constructor is the %PluralRules% intrinsic object and a standard built-in property of the Intl object. Behaviour common to all service constructor properties of the Intl object is specified in
When the Intl.PluralRules
function is called with optional arguments locales and options, the following steps are taken:
The abstract operation InitializePluralRules accepts the arguments pluralRules (which must be an object), locales, and options. It initializes pluralRules as a PluralRules object. The following steps are taken:
The Intl.PluralRules constructor has the following properties:
The value of Intl.PluralRules.prototype
is
This property has the attributes { [[Writable]]:
When the supportedLocalesOf
method is called with arguments locales and options, the following steps are taken:
The value of the [[AvailableLocales]] internal slot is implementation-defined within the constraints described in
The value of the [[RelevantExtensionKeys]] internal slot is « ».
The value of the [[LocaleData]] internal slot is implementation-defined within the constraints described in
The Intl.PluralRules prototype object is itself an ordinary object. %PluralRules.prototype% is not an Intl.PluralRules instance and does not have an [[InitializedPluralRules]] internal slot or any of the other internal slots of Intl.PluralRules instance objects.
The initial value of Intl.PluralRules.prototype.constructor
is
The initial value of the @@toStringTag property is the String value
This property has the attributes { [[Writable]]:
When the select
method is called with an argument value, the following steps are taken:
When the selectRange
method is called with arguments start and end, the following steps are taken:
This function provides access to the locale and options computed during initialization of the object.
Internal Slot | Property |
---|---|
[[Locale]] | |
[[Type]] | |
[[MinimumIntegerDigits]] | |
[[MinimumFractionDigits]] | |
[[MaximumFractionDigits]] | |
[[MinimumSignificantDigits]] | |
[[MaximumSignificantDigits]] | |
[[RoundingMode]] | |
[[RoundingIncrement]] | |
[[TrailingZeroDisplay]] |
Intl.PluralRules instances are ordinary objects that inherit properties from
Intl.PluralRules instances have an [[InitializedPluralRules]] internal slot.
Intl.PluralRules instances also have several internal slots that are computed by the constructor:
The abstract operation GetOperands takes argument s (a decimal String). It extracts numeric features from s that correspond with the operands of Unicode Technical Standard #35 Part 3 Numbers, Section 5.1.1 Operands. It performs the following steps when called:
Internal Slot | Type | UTS #35 Operand | Description |
---|---|---|---|
[[Number]] | Number | n | Absolute value of the source number |
[[IntegerDigits]] | Number | i | Integer part of [[Number]]. |
[[FractionDigits]] | Number | f | Visible fraction digits in [[Number]], with trailing zeroes, as an integer having [[NumberOfFractionDigits]] digits. |
[[NumberOfFractionDigits]] | Number | v | Number of visible fraction digits in [[Number]], with trailing zeroes. |
[[FractionDigitsWithoutTrailing]] | Number | t | Visible fraction digits in [[Number]], without trailing zeroes, as an integer having [[NumberOfFractionDigitsWithoutTrailing]] digits. |
[[NumberOfFractionDigitsWithoutTrailing]] | Number | w | Number of visible fraction digits in [[Number]], without trailing zeroes. |
The implementation-defined abstract operation PluralRuleSelect takes arguments locale (a String), type (a String), n (a finite Number), and operands (a Plural Rules Operands Record derived from formatting n). It returns the String from «
When the ResolvePlural abstract operation is called with arguments pluralRules (which must be an object initialized as a PluralRules) and n (which must be a Number value), it returns a Record containing two values: a String value representing the plural form of n according to the effective locale and the options of pluralRules in the field [[PluralCategory]], and n as a formatted string in the field [[FormattedString]]. The following steps are taken:
When the PluralRuleSelectRange abstract operation is called with four arguments, it performs an implementation-dependent algorithm to map the plural form String values xp and yp, representing the plural forms of the start and end of a range, to a resolved String value for the plural form of the range as a whole denoted by type for the corresponding locale, or the String value
When the ResolvePluralRange abstract operation is called with arguments pluralRules (which must be an object initialized as a PluralRules), x (which must be a Number value), and y (which must be a Number value), it returns a String value representing the plural form of the range starting from x and ending at y according to the effective locale and the options of pluralRules. The following steps are taken: