parameters: (text)
return_statement: return messages
docstring: Parse 'po' format produced by xgettext.
      Return a list of (msgid,msgstr) tuples.
docstring_summary: Parse 'po' format produced by xgettext.
      Return a list of (msgid,msgstr) tuples.
docstring_tokens: Parse po format produced by xgettext . Return a list of ( msgid msgstr ) tuples .
function: def parse_po(text):
      """
      Parse 'po' format produced by xgettext.
      Return a list of (msgid,msgstr) tuples.
      """
      messages = []
      msgid = []
      msgstr = []
      in_msgid = False
      in_msgstr = False
  
      for line in text.split('\n'):
          line = line.rstrip('\r')
          if line.startswith('msgid '):
              if in_msgstr:
                  messages.append((msgid, msgstr))
                  in_msgstr = False
              # message start
              in_msgid = True
              
              msgid = [line[6:]]
          elif line.startswith('msgstr '):
              in_msgid = False
              in_msgstr = True
              msgstr = [line[7:]]
          elif line.startswith('"'):
              if in_msgid:
                  msgid.append(line)
              if in_msgstr:
                  msgstr.append(line)
  
      if in_msgstr:
          messages.append((msgid, msgstr))
  
      return messages
function_tokens: def parse_po ( text ) : messages = [ ] msgid = [ ] msgstr = [ ] in_msgid = False in_msgstr = False for line in text . split ( '\n' ) : line = line . rstrip ( '\r' ) if line . startswith ( 'msgid ' ) : if in_msgstr : messages . append ( ( msgid , msgstr ) ) in_msgstr = False # message start in_msgid = True msgid = [ line [ 6 : ] ] elif line . startswith ( 'msgstr ' ) : in_msgid = False in_msgstr = True msgstr = [ line [ 7 : ] ] elif line . startswith ( '"' ) : if in_msgid : msgid . append ( line ) if in_msgstr : msgstr . append ( line ) if in_msgstr : messages . append ( ( msgid , msgstr ) ) return messages