def yield_translation_csv_messages(file, no_header=False):
 csvreader = csv.reader(file, lineterminator='\n')
 if (not no_header):
  columns = next(csvreader)
  assert (columns == 'language_id,table,id,column,source_crc,string'.split(','))
 for (language_id, table, id, column, source_crc, string) in csvreader:
  if isinstance(string, bytes):
   string = string.decode('utf-8')
  (yield Message(table, int(id), column, string, origin='target CSV', source_crc=source_crc, language_id=int(language_id)))

def yield_translation_csv_messages ( file , no_header = False ) : csvreader = csv . reader ( file , lineterminator = '\n' ) if ( not no_header ) : columns = next ( csvreader ) assert ( columns == 'language_id,table,id,column,source_crc,string' . split ( ',' ) ) for ( language_id , table , id , column , source_crc , string ) in csvreader : if isinstance ( string , bytes ) : string = string . decode ( 'utf-8' ) ( yield Message ( table , int ( id ) , column , string , origin = 'target CSV' , source_crc = source_crc , language_id = int ( language_id ) ) )
yield messages from a translation csv file .