Upstream: Pending, https://github.com/getting-things-gnome/gtg/pull/387 From a03b68f636f21a92922aff9be2b3b728a4bcd52f Mon Sep 17 00:00:00 2001 From: Rasmus Thomsen Date: Thu, 2 Jul 2020 09:27:37 +0200 Subject: [PATCH] Gracefully handle locale.{bind,}textdomain not being available When python is built without gettext support these functions aren't available and as such GTG fails to start without this change. --- GTG/gtg.in | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/GTG/gtg.in b/GTG/gtg.in index a4ea12df..ea310186 100755 --- a/GTG/gtg.in +++ b/GTG/gtg.in @@ -99,8 +99,17 @@ if __name__ == "__main__": # Set up UI i18n LOCALE_DIR = '@localedir@' - locale.bindtextdomain('gtg', LOCALE_DIR) - locale.textdomain('gtg') + + try: + locale.bindtextdomain('gtg', LOCALE_DIR) + locale.textdomain('gtg') + except AttributeError as e: + # Python built without gettext support doesn't have bindtextdomain() + # and textdomain(), so gracefully fail here. + print( + "Couldn't bind the translation domain. Some translations won't " + "work.\n{}".format(e)) + gettext.bindtextdomain('gtg', LOCALE_DIR) gettext.textdomain('gtg')