1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-22 18:55:29 +03:00
aports/community/gnome-authenticator/dont-require-py3-gettext-support.patch
Rasmus Thomsen a49f653369 community/gnome-authenticator: fix startup with upstream patch
Also use upstream patch for setting the locale while we're at it.
2020-07-08 16:21:30 +00:00

38 lines
1.4 KiB
Diff

Upstream: Pending, https://gitlab.gnome.org/World/Authenticator/-/merge_requests/160
From 4073b3f3d97f0c4d74a7017da181fb4e41bdef8e Mon Sep 17 00:00:00 2001
From: Rasmus Thomsen <oss@cogitri.dev>
Date: Wed, 8 Jul 2020 18:08:16 +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.
---
src/authenticator.py.in | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/authenticator.py.in b/src/authenticator.py.in
index 1e75e10..2cc371f 100755
--- a/src/authenticator.py.in
+++ b/src/authenticator.py.in
@@ -35,8 +35,15 @@ from gi.repository import Gio, Handy
sys.path.insert(1, '@PYTHON_DIR@')
def prepare_locale():
- locale.bindtextdomain('@GETTEXT_PACKAGE@', '@LOCALE_DIR@')
- locale.textdomain('@GETTEXT_PACKAGE@')
+ try:
+ locale.bindtextdomain('@GETTEXT_PACKAGE@', '@LOCALE_DIR@')
+ locale.textdomain('@GETTEXT_PACKAGE@')
+ except AttributeError as e:
+ # Python built without gettext support doesn't have bindtextdomain()
+ # and textdomain()
+ print("Couldn't bind the gettext translation domain. Some translations"
+ " won't work.\n{}".format(e))
+
gettext.bindtextdomain('@GETTEXT_PACKAGE@', '@LOCALE_DIR@')
gettext.textdomain('@GETTEXT_PACKAGE@')
--
GitLab