def parse(ps): header = read_header_items(ps) units = [] try: while True: eat_whitespace(ps) skip_no_translate(ps) match = string_entry_re.match(ps.current_line) if match is not None: units.append((match.groupdict()['id'], extractpoline(match.groupdict()['str']))) ps.read_line() except StopIteration: pass return header, units
def _prepare_db_string(string): """Helper method needed by the Berkeley DB TM converters.""" string = '"%s"' % string string = unicode(extractpoline(string), 'utf-8') return string