def _parse(self, is_source, lang_rules):
        """
        Parse a PO file and create a stringset with all PO entries in the file.
        """
        if lang_rules:
            nplural = len(lang_rules)
        else:
            nplural = self.language.get_pluralrules_numbers()

        if not hasattr(self, '_po'):
            self.is_content_valid()

        self._parse_copyrights(self.content)
        try:
            self._po = polib.pofile(self.content)
        except __HOLE__, e:
            raise PoParseError(unicode(e))

        for entry in self._po:
            pluralized = False
            same_nplural = True

            # skip obsolete entries
            if entry.obsolete:
                continue

            # treat fuzzy translation as nonexistent
            if "fuzzy" in entry.flags:
                if not is_source:
                    if not entry.msgid_plural:
                        self._add_suggestion_string(
                            entry.msgid, entry.msgstr,
                            context=escape_context(entry.msgctxt) or '',
                            occurrences=self._serialize_occurrences(entry.occurrences)
                        )
                    continue
                else:
                    # Drop fuzzy flag from template
                    entry.flags.remove("fuzzy")

            if entry.msgid_plural:
                pluralized = True
                if is_source:
                    nplural_file = len(entry.msgstr_plural.keys())
                    if nplural_file != 2:
                        raise PoParseError(_("Your source file is not a POT file and"
                            " the translation file you're using has more"
                            " than two plurals which is not supported."))
                    # English plural rules
                    messages = [(1, entry.msgstr_plural['0'] or entry.msgid),
                                (5, entry.msgstr_plural['1'] or entry.msgid_plural)]
                    plural_keys = [0,1]
                else:
                    message_keys = entry.msgstr_plural.keys()
                    message_keys.sort()
                    nplural_file = len(message_keys)
                    messages = []
                    if nplural:
                        if len(nplural) != nplural_file:
                            logger.error("Passed plural rules has nplurals=%s"
                                ", but '%s' file has nplurals=%s. String '%s'"
                                "skipped." % (nplural, self.filename, nplural_file,
                                entry.msgid))
                            same_nplural = False
                    else:
                        same_nplural = False

                    if not same_nplural:
                        # Skip half translated plurals
                        continue
                        # plural_keys = message_keys

                    for n, key in enumerate(message_keys):
                        messages.append((nplural[n], entry.msgstr_plural['%s' % n]))
            else:
                # pass empty strings for non source files
                if not is_source and entry.msgstr in ["", None]:
                    continue
                # Not pluralized, so no plural rules. Use 5 as 'other'.
                if is_source:
                    messages = [(5, entry.msgstr or entry.msgid)]
                else:
                    messages = [(5, entry.msgstr)]

            # Add messages with the correct number (plural)
            for number, msgstr in enumerate(messages):
                if entry.comment:
                    comment = entry.comment
                else:
                    comment = None
                if entry.flags:
                    flags = ', '.join( f for f in entry.flags)
                else:
                    flags = None
                context=escape_context(entry.msgctxt) or ''
                self._add_translation_string(
                    entry.msgid, msgstr[1], context=context,
                    occurrences=self._serialize_occurrences(entry.occurrences),
                    rule=msgstr[0], pluralized=pluralized, comment=comment,
                    flags=flags
                )

            if is_source:
                entry.msgstr = "%(hash)s_tr" % {
                    'hash': hash_tag(entry.msgid, context)
                }

                if entry.msgid_plural:
                    for n, rule in enumerate(plural_keys):
                        entry.msgstr_plural['%s' % n] = (
                            "%(hash)s_pl_%(key)s" % {
                                'hash':hash_tag(entry.msgid, context),
                                'key':n
                            }
                        )
        return self._po
dataset/ETHPy150Open rvanlaar/easy-transifex/src/transifex/transifex/resources/formats/pofile.py/GettextHandler._parse