equal
deleted
inserted
replaced
548 """ |
548 """ |
549 Return the binary representation of the file. |
549 Return the binary representation of the file. |
550 """ |
550 """ |
551 offsets = [] |
551 offsets = [] |
552 entries = self.translated_entries() |
552 entries = self.translated_entries() |
553 |
|
554 # the keys are sorted in the .mo file |
|
555 def cmp(_self, other): |
|
556 # msgfmt compares entries with msgctxt if it exists |
|
557 self_msgid = _self.msgctxt and _self.msgctxt or _self.msgid |
|
558 other_msgid = other.msgctxt and other.msgctxt or other.msgid |
|
559 if self_msgid > other_msgid: |
|
560 return 1 |
|
561 elif self_msgid < other_msgid: |
|
562 return -1 |
|
563 else: |
|
564 return 0 |
|
565 |
553 |
566 # add metadata entry |
554 # add metadata entry |
567 entries.sort(key=lambda o: o.msgctxt or o.msgid) |
555 entries.sort(key=lambda o: o.msgctxt or o.msgid) |
568 mentry = self.metadata_as_entry() |
556 mentry = self.metadata_as_entry() |
569 # mentry.msgstr = mentry.msgstr.replace('\\n', '').lstrip() |
557 # mentry.msgstr = mentry.msgstr.replace('\\n', '').lstrip() |