polib.py

Workaround for polib issue and required improvement to make work mdpo.

See https://github.com/izimobil/polib/pulls for details.

mdpo.polib.poentry__cmp__(self, other, compare_obsolete=True, compare_msgstr=True, compare_occurrences=True)

Custom comparation __cmp__ function for polib.POEntry.

This function acts like a workaround for https://github.com/izimobil/polib/pulls/95 and add custom entries comparison capabilities to polib.POEntry, needed by mdpo to prevent some errors. This function is compatible with the comparison function defined by polib, the method polib.POEntry.__cmp__() can be replaced by this function without any downsides.

Parameters
  • self (polib.POEntry) – Entry to be compared.

  • other (polib.POEntry) – Entry to compare against.

  • compare_obsolete (bool) – Indicates if the obsolete property of the entries will be used comparing them.

  • compare_msgstr (bool) – Indicates if the msgstr property of the entries will be used comparing them.

  • compare_occurrences (bool) – Indicates if the occurrences property of the entries will be used comparing them.