Subject: [PATCH] community/deluge: Fix warning about ngettext

From: Wolf <[email-masked]>
Date: Sat, 25 Sep 2021 18:04:39 +0200

This patch is scheduled for 2.0.4 and without it logs are full of
warnings about not being able to initialize gettext/locale. This commit
backports it 2.0.3.
---
I'm using this for quite some time and it introduces no issues.

 community/deluge/20-fix-gettext-warning.patch | 29 +++++++++++++++++++
 community/deluge/APKBUILD                     | 10 +++++--
 2 files changed, 36 insertions(+), 3 deletions(-)
 create mode 100644 community/deluge/20-fix-gettext-warning.patch

diff --git a/community/deluge/20-fix-gettext-warning.patch b/community/deluge/20-fix-gettext-warning.patch
new file mode 100644
index 0000000000..bdbc7d7b81
--- /dev/null
+++ b/community/deluge/20-fix-gettext-warning.patch
@@ -0,0 +1,29 @@
+From d6c96d629183e8bab2167ef56457f994017e7c85 Mon Sep 17 00:00:00 2001
+From: neeshy <[email-masked]>
+Date: Sat, 18 Apr 2020 23:23:51 -0400
+Subject: Fix warning related to gettext
+
+---
+https://dev.deluge-torrent.org/changeset/d6c96d629183e8bab2167ef56457f994017e7c85
+
+Will be part of 2.0.4 release.
+
+ deluge/i18n/util.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/deluge/i18n/util.py b/deluge/i18n/util.py
+index bd002f7..90568fc 100644
+--- a/deluge/i18n/util.py
++++ b/deluge/i18n/util.py
+@@ -114,7 +114,7 @@ def setup_translation():
+         # Workaround for Python 2 unicode gettext (keyword removed in Py3).
+         kwargs = {} if not deluge.common.PY2 else {'unicode': True}
+ 
+-        gettext.install(I18N_DOMAIN, translations_path, names='ngettext', **kwargs)
++        gettext.install(I18N_DOMAIN, translations_path, names=['ngettext'], **kwargs)
+         builtins.__dict__['_n'] = builtins.__dict__['ngettext']
+ 
+         libintl = None
+-- 
+cgit v1.1
+
diff --git a/community/deluge/APKBUILD b/community/deluge/APKBUILD
index 8c8ab0b7e6..2c705e5041 100644
--- a/community/deluge/APKBUILD
+++ b/community/deluge/APKBUILD
@@ -3,7 +3,7 @@
 # Maintainer: August Klein <[email-masked]>
 pkgname=deluge
 pkgver=2.0.3
-pkgrel=8
+pkgrel=9
 pkgdesc="lightweight, Free Software, cross-platform BitTorrent client"
 url="https://deluge-torrent.org/"
 arch="noarch !armv7 !aarch64 !x86" # Missing py3-libtorrent-rasterbar
@@ -34,6 +34,7 @@ depends="
 subpackages="$pkgname-doc"
 source="http://download.deluge-torrent.org/source/${pkgver%.*}/deluge-$pkgver.tar.xz
 	10-python38-logging.patch
+	20-fix-gettext-warning.patch
 	"
 
 replaces="$pkgname-lang" # Overwrite removed subpackage
@@ -46,5 +47,8 @@ package() {
 	python3 setup.py install --prefix=/usr --root="$pkgdir"
 }
 
-sha512sums="3abec24495b22ec10649865c7ce7c3271224c7d25c0647b43f3c177b7ccb45d4c5c593f8c89d8bc8eac85ae5dc737f9960827587912dd527bb96100304a7d480  deluge-2.0.3.tar.xz
-8ab11f87ddf62a7cba2d2783eec2c439fdc416e5d165ac6b510a9818c28573df32ef408bb16ca61d93b27bb5090782f5b4005a4ad50cfa9fa6dfb869aa2be57c  10-python38-logging.patch"
+sha512sums="
+3abec24495b22ec10649865c7ce7c3271224c7d25c0647b43f3c177b7ccb45d4c5c593f8c89d8bc8eac85ae5dc737f9960827587912dd527bb96100304a7d480  deluge-2.0.3.tar.xz
+8ab11f87ddf62a7cba2d2783eec2c439fdc416e5d165ac6b510a9818c28573df32ef408bb16ca61d93b27bb5090782f5b4005a4ad50cfa9fa6dfb869aa2be57c  10-python38-logging.patch
+cba3bbe02f7915f76eaa9633daf2894cd56811041e53d66ee7a3baf1e2f01337ad5f20058bc489d3e5bfd335ac51a3635d3aa9167c33ed7e04e13c6f6c6c8600  20-fix-gettext-warning.patch
+"
-- 
2.33.0