阿西河

所有教程

公众号
🌙
阿西河前端的公众号

我的收藏

    最近访问  (文章)

      教程列表

      抓包专区
      测试专区

      JS Intl.PluralRules.select()

      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

      SpecificationStatusComment
      Intl Plural Rules DraftDraftInitial definition

      See also

      目录
      目录