Skip to content

Commit cbe1cf4

Browse files
committed
meldapp: Monkey-patch optparse's gettext alias for ugettext compat
Meld uses and assumes ugettext for our translations, and this doesn't interact well with optparse's use of gettext, when it tries to mash together its bytestring translations with our unicode translations. While this is an ugly hack, the only other simple option is not using optparse, which is a longer-term goal but much too invasive for a quick fix.
1 parent 59c9e15 commit cbe1cf4

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

meld/meldapp.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434

3535
log = logging.getLogger(__name__)
3636

37+
# Monkeypatching optparse like this is obviously awful, but this is to
38+
# handle Unicode translated strings within optparse itself that will
39+
# otherwise crash badly. This just makes optparse use our ugettext
40+
# import of _, rather than the non-unicode gettext.
41+
optparse._ = _
42+
3743

3844
class MeldApp(Gtk.Application):
3945

0 commit comments

Comments
 (0)