def read_possible_plural_rules():
 plurals = {}
 try:
  import gluon.contrib.plural_rules as package
  for (importer, modname, ispkg) in pkgutil.iter_modules(package.__path__):
   if (len(modname) == 2):
    module = __import__(((package.__name__ + '.') + modname), fromlist=[modname])
    lang = modname
    pname = (modname + '.py')
    nplurals = getattr(module, 'nplurals', DEFAULT_NPLURALS)
    get_plural_id = getattr(module, 'get_plural_id', DEFAULT_GET_PLURAL_ID)
    construct_plural_form = getattr(module, 'construct_plural_form', DEFAULT_CONSTRUCT_PLURAL_FORM)
    plurals[lang] = (lang, nplurals, get_plural_id, construct_plural_form)
 except ImportError:
  e = sys.exc_info()[1]
  logging.warn(('Unable to import plural rules: %s' % e))
 return plurals

def read_possible_plural_rules ( ) : plurals = { } try : import gluon . contrib . plural_rules as package for ( importer , modname , ispkg ) in pkgutil . iter_modules ( package . __path__ ) : if ( len ( modname ) == 2 ) : module = __import__ ( ( ( package . __name__ + '.' ) + modname ) , fromlist = [ modname ] ) lang = modname pname = ( modname + '.py' ) nplurals = getattr ( module , 'nplurals' , DEFAULT_NPLURALS ) get_plural_id = getattr ( module , 'get_plural_id' , DEFAULT_GET_PLURAL_ID ) construct_plural_form = getattr ( module , 'construct_plural_form' , DEFAULT_CONSTRUCT_PLURAL_FORM ) plurals [ lang ] = ( lang , nplurals , get_plural_id , construct_plural_form ) except ImportError : e = sys . exc_info ( ) [ 1 ] logging . warn ( ( 'Unable to import plural rules: %s' % e ) ) return plurals
creates list of all possible plural rules files the result is cached in plural_rules dictionary to increase speed .