JavaScript pluralize an english string

前端 未结 11 1057
南旧
南旧 2020-12-23 16:24

In PHP, I use Kuwamoto\'s class to pluralize nouns in my strings. I didn\'t find something as good as this script in javascript except for some plugins. So, it would be grea

11条回答
  •  被撕碎了的回忆
    2020-12-23 17:03

    The new intl API spec from ECMA will provide the plural rules function, https://github.com/tc39/proposal-intl-plural-rules

    Here's the polyfill that can be used today https://github.com/eemeli/IntlPluralRules

提交回复
热议问题