Intl.PluralRules.select() - JavaScript 编辑
The Intl.PluralRules.prototype.select
method returns a String indicating which plural rule to use for locale-aware formatting.
Syntax
pluralCategory = pluralRule.select(number)
Parameters
number
- The number to get a plural rule for.
Return value
A string
representing the pluralization category of the number
, can be one of zero
, one
, two
, few
, many
or other
.
Description
This function selects a pluralization category according to the locale and formatting options of a PluralRules
object.
Examples
Using select()
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'
Specifications
Specification |
---|
ECMAScript Internationalization API (ECMA-402) The definition of 'Intl.PluralRules.select()' in that specification. |
Browser compatibility
BCD tables only load in the browser
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论