Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow more control comparing PO entries #108

Open
mondeja opened this issue May 1, 2021 · 0 comments
Open

Allow more control comparing PO entries #108

mondeja opened this issue May 1, 2021 · 0 comments

Comments

@mondeja
Copy link
Contributor

mondeja commented May 1, 2021

I've a case in which I'm comparing PO entries without take into account msgstr neither obsolete. Currently, I'm duplicating the POEntry.__cmp__ function adding optional parameters compare_obsolete and compare_msgstr. Could this be added to polib, maybe adding other parameters for msgstr_plural, msgid...?

class Foo:
    def __cmp__(self, other, are_equal=False, other_are_equal=False):
        if are_equal or other_are_equal:
            return True
        return False

a = Foo()
b = Foo()

print(a == b)                                                  # False
print(a != b)                                                  # True
print(a.__cmp__(b))                                            # False
print(a.__cmp__(b, are_equal=False, other_are_equal=True))     # True
print(a.__cmp__(b, are_equal=True, other_are_equal=False))     # True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant