def parse(self, resource):
try:<EOL><INDENT>import polib<EOL><DEDENT>except ImportError as e:<EOL><INDENT>self.rethrow(<EOL>"<STR_LIT>",<EOL>ImportError)<EOL><DEDENT>self.assert_valid_path(resource)<EOL>messages = {}<EOL>parsed = self._load_contents(polib, resource)<EOL>for item in parsed:<EOL><INDENT>if item.msgid_plural:<EOL><INDENT>plurals = sorted(item.msgstr_plural.items())<EOL>if item.msgid and len(plurals) > <NUM_LIT:1>:<EOL><INDENT>messages[item.msgid] = plurals[<NUM_LIT:0>][<NUM_LIT:1>]<EOL><DEDENT>plurals = [msgstr for idx, msgstr in plurals]<EOL>messages[item.msgid_plural] = "<STR_LIT:|>".join(plurals)<EOL><DEDENT>elif item.msgid:<EOL><INDENT>messages[item.msgid] = item.msgstr<EOL><DEDENT><DEDENT>return messages<EOL>
Loads given resource into a dict using polib

@type resource: str
@param resource: resource

@rtype: list