parameters: (fn)
docstring: checks .po file
docstring_summary: checks .po file
docstring_tokens: checks . po file
function: def check_po(fn):
  	"""checks .po file"""
  	warn_cnt = 0
  	item_cnt = 0
  	empty_item_cnt = 0
  	f = open(fn, 'r')
  	lines = f.readlines()
  	f.close()
  	msgid = ''
  	msgstr = ''
  	line_no = 0
  	last_line = ''
  	for line in lines:
  		line_no += 1
  		line0 = line
  		line = line.strip()
  		line = line.strip('"')
  		if line.startswith('msgid '):
  			item_cnt += 1
  			msgid = line[6:]
  			msgstr = ''
  		elif line.startswith('msgstr '):
  			msgstr = line[7:]
  			msgid = msgid.strip('"')
  			msgstr = msgstr.strip('"')
  		elif line:
  			if msgid:
  				msgid += line
  			if msgstr:
  				msgstr += line
  		else:
  			if last_line.startswith('msgstr ""'):
  				empty_item_cnt += 1
  			elif msgstr:
  				line_warns = []
  				wc = check_str(msgid, msgstr, line_warns)
  				if wc:
  					print('%s:%d:%s: [%s] [%s]' % (fn, line_no, ','.join(line_warns), msgid, msgstr))
  					warn_cnt += wc
  				msgstr = ''
  		last_line = line0
  	print('%s: items: %d; empty items: %d; warning cnt: %d' % (fn, item_cnt, empty_item_cnt, warn_cnt))
function_tokens: def check_po ( fn ) : warn_cnt = 0 item_cnt = 0 empty_item_cnt = 0 f = open ( fn , 'r' ) lines = f . readlines ( ) f . close ( ) msgid = '' msgstr = '' line_no = 0 last_line = '' for line in lines : line_no += 1 line0 = line line = line . strip ( ) line = line . strip ( '"' ) if line . startswith ( 'msgid ' ) : item_cnt += 1 msgid = line [ 6 : ] msgstr = '' elif line . startswith ( 'msgstr ' ) : msgstr = line [ 7 : ] msgid = msgid . strip ( '"' ) msgstr = msgstr . strip ( '"' ) elif line : if msgid : msgid += line if msgstr : msgstr += line else : if last_line . startswith ( 'msgstr ""' ) : empty_item_cnt += 1 elif msgstr : line_warns = [ ] wc = check_str ( msgid , msgstr , line_warns ) if wc : print ( '%s:%d:%s: [%s] [%s]' % ( fn , line_no , ',' . join ( line_warns ) , msgid , msgstr ) ) warn_cnt += wc msgstr = '' last_line = line0 print ( '%s: items: %d; empty items: %d; warning cnt: %d' % ( fn , item_cnt , empty_item_cnt , warn_cnt ) )