def lang_stats(resources=None, languages=None):
 locale_dirs = _get_locale_dirs()
 for (name, dir_) in locale_dirs:
  if (resources and (not (name in resources))):
   continue
  print ("\nShowing translations stats for '%s':" % name)
  langs = sorted([d for d in os.listdir(dir_) if (not d.startswith('_'))])
  for lang in langs:
   if (languages and (not (lang in languages))):
    continue
   p = Popen(('msgfmt -vc -o /dev/null %(path)s/%(lang)s/LC_MESSAGES/django%(ext)s.po' % {'path': dir_, 'lang': lang, 'ext': ('js' if name.endswith('-js') else '')}), stdout=PIPE, stderr=PIPE, shell=True)
   (output, errors) = p.communicate()
   if (p.returncode == 0):
    print ('%s: %s' % (lang, errors.strip()))
   else:
    print ('Errors happened when checking %s translation for %s:\n%s' % (lang, name, errors))

def lang_stats ( resources = None , languages = None ) : locale_dirs = _get_locale_dirs ( ) for ( name , dir_ ) in locale_dirs : if ( resources and ( not ( name in resources ) ) ) : continue print ( "\nShowing translations stats for '%s':" % name ) langs = sorted ( [ d for d in os . listdir ( dir_ ) if ( not d . startswith ( '_' ) ) ] ) for lang in langs : if ( languages and ( not ( lang in languages ) ) ) : continue p = Popen ( ( 'msgfmt -vc -o /dev/null %(path)s/%(lang)s/LC_MESSAGES/django%(ext)s.po' % { 'path' : dir_ , 'lang' : lang , 'ext' : ( 'js' if name . endswith ( '-js' ) else '' ) } ) , stdout = PIPE , stderr = PIPE , shell = True ) ( output , errors ) = p . communicate ( ) if ( p . returncode == 0 ) : print ( '%s: %s' % ( lang , errors . strip ( ) ) ) else : print ( 'Errors happened when checking %s translation for %s:\n%s' % ( lang , name , errors ) )
output language statistics of committed translation files for each django catalog .