Intl.PluralRules.prototype.select
method returns a String indicating which plural rule to use for locale-aware formatting.
pluralCategory = pluralRule.select(number)
number
The number to get a plural rule for.
A
string
representing the pluralization category of the
number
, can be one of
zero
,
one
,
two
,
few
,
many
or
other
.
This function selects a pluralization category according to the locale and formatting options of a
PluralRules
对象。
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'
| 规范 |
|---|
|
ECMAScript 国际化 API (ECMA-402)
The definition of 'Intl.PluralRules.select()' in that specification. |
| Desktop | Mobile | Server | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
select
|
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
|
完整支持
不支持
见实现注意事项。
Intl
Collator
DateTimeFormat
ListFormat
NumberFormat
PluralRules
RelativeTimeFormat
Object
Object.prototype.__defineGetter__()
Object.prototype.__defineSetter__()
Object.prototype.__lookupGetter__()
Object.prototype.__lookupSetter__()
Object.prototype.hasOwnProperty()
Object.prototype.isPrototypeOf()
Object.prototype.propertyIsEnumerable()
Object.prototype.toLocaleString()
Object.prototype.toSource()
Object.prototype.toString()
Object.prototype.valueOf()
Object.setPrototypeOf()