def _parse(self, is_source, lang_rules):
        """Parse an apple .strings file and create a stringset with
        all entries in the file.

        See
        http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPInternational/Articles/StringsFiles.html
        for details.
        """
        resource = self.resource
        context = ""
        f = self.content
        p = re.compile(r'(?P<line>(("(?P<key>[^"\\]*(?:\\.[^"\\]*)*)")|(?P<property>\w+))\s*=\s*"(?P<value>[^"\\]*(?:\\.[^"\\]*)*)"\s*;)', re.U)
        c = re.compile(r'\s*/\*(.|\s)*?\*/\s*', re.U)
        ws = re.compile(r'\s+', re.U)
        buf = u""
        end=0
        start = 0
        for i in p.finditer(f):
            start = i.start()
            end_ = i.end()
            line = i.group('line')
            key = i.group('key')
            if not key:
                key = i.group('property')
            value = i.group('value')
            while end < start:
                m = c.match(f, end, start) or ws.match(f, end, start)
                if not m or m.start() != end:
                    raise StringsParseError("Invalid syntax.")
                if is_source:
                    buf += f[end:m.end()]
                end = m.end()
            end = end_
            if is_source:
                if not value.strip():
                    buf += line
                    continue
                else:
                    line = f[start:end]
                    buf += line[0:i.start('value')-start]
                    buf += re.sub(
                        re.escape(value),
                        "%(hash)s_tr" % {'hash': hash_tag(key, context)},
                        line[i.start('value')-start:i.end('value')-start]
                    )
                    buf += line[i.end('value')-start:]
            elif not SourceEntity.objects.filter(resource=resource, string=key).exists() or not value.strip():
                # ignore keys with no translation
                continue
            self.stringset.strings.append(GenericTranslation(key,
                self._unescape(value), rule=5, context=context,
                pluralized=False, fuzzy=False,
                obsolete=False))
        while len(f[end:]):
            m = c.match(f, end) or ws.match(f, end)
            if not m or m.start() != end:
                raise StringsParseError("Invalid syntax.")
            if is_source:
                buf += f[end:m.end()]
            end = m.end()
            if end == 0:
                break
        return buf
dataset/ETHPy150Open rvanlaar/easy-transifex/src/transifex/transifex/resources/formats/strings.py/AppleStringsHandler._parse/original