def _get_plural_forms(js_translations):
 plural = None
 n_plural = 2
 if ('' in js_translations._catalog):
  for l in js_translations._catalog[''].split('\n'):
   if l.startswith('Plural-Forms:'):
    plural = l.split(':', 1)[1].strip()
    print ('plural is %s' % plural)
 if (plural is not None):
  for raw_element in plural.split(';'):
   element = raw_element.strip()
   if element.startswith('nplurals='):
    n_plural = int(element.split('=', 1)[1])
   elif element.startswith('plural='):
    plural = element.split('=', 1)[1]
    print ('plural is now %s' % plural)
 else:
  n_plural = 2
  plural = '(n == 1) ? 0 : 1'
 return (plural, n_plural)

def _get_plural_forms ( js_translations ) : plural = None n_plural = 2 if ( '' in js_translations . _catalog ) : for l in js_translations . _catalog [ '' ] . split ( '\n' ) : if l . startswith ( 'Plural-Forms:' ) : plural = l . split ( ':' , 1 ) [ 1 ] . strip ( ) print ( 'plural is %s' % plural ) if ( plural is not None ) : for raw_element in plural . split ( ';' ) : element = raw_element . strip ( ) if element . startswith ( 'nplurals=' ) : n_plural = int ( element . split ( '=' , 1 ) [ 1 ] ) elif element . startswith ( 'plural=' ) : plural = element . split ( '=' , 1 ) [ 1 ] print ( 'plural is now %s' % plural ) else : n_plural = 2 plural = '(n == 1) ? 0 : 1' return ( plural , n_plural )
extracts the parameters for what constitutes a plural .