ATM I do not have the time to do this, I'll see what I can do when I
have some time...
(Patches are welcome of course :) )
Cheers,
David.
Thanks for the patch Sebastian, your contrib is appreciated !
I reviewed the patch and here are some comments:
1) I applied the patch and did a simple test on a test file (provided in
polib):
>>> import polib
>>> po = polib.pofile('tests/test_utf8.po')
>>> po.sort()
>>> po.save('tmp.po')
Then I compared tmp.po and the original (with vimdiff) and they are
not sorted the same way, I think that we miss something on how gettext
do the sorting, hopefully it will be an easy fix...
2) Some nitpicking:
- the compareOccurrences should be named compare_occurrences and could
be an inner function (in the __cmp__ func) since it is only used here,
- we should not use enumerate() since polib is compatible with python 2.3,
- a try/except should be added when doing "entry2 = occ2[pos]" because
there could be an IndexError exception if the compared entry has less
occurrences than the current one...
Cheers,
David.
:)
So, in other words, casting line numbers to int in compareOcccurences
fixes the problem.
I'll integrate your changes in svn (and in the next release) soon, but I
need to invistigate more on how gettext behaves by default.
Thanks for your time,
David.