gliphy / rpms / mcomix3

Forked from rpms/mcomix3 3 years ago
Clone

Blame 0003-Search-gettext-files-in-system-wide-directory.patch

b25042f
From 4d3f0e0c27ab7fd933f3654c349e7b5e00028659 Mon Sep 17 00:00:00 2001
b25042f
From: mcomix3 Fedora maintainer <mcomix3-owner@fedoraproject.org>
b25042f
Date: Mon, 4 Nov 2019 15:14:45 +0900
b25042f
Subject: [PATCH] Search gettext files in system-wide directory
b25042f
b25042f
---
b25042f
 mcomix/mcomix/i18n.py | 9 +++++++++
b25042f
 1 file changed, 9 insertions(+)
b25042f
b25042f
diff --git a/mcomix/mcomix/i18n.py b/mcomix/mcomix/i18n.py
b25042f
index 96a209c..54377d1 100644
b25042f
--- a/mcomix/mcomix/i18n.py
b25042f
+++ b/mcomix/mcomix/i18n.py
b25042f
@@ -5,6 +5,7 @@ import locale
b25042f
 import os
b25042f
 import sys
b25042f
 import threading
b25042f
+import sysconfig
b25042f
 
b25042f
 try:
b25042f
     import chardet
b25042f
@@ -114,6 +115,14 @@ def install_gettext():
b25042f
             break
b25042f
         except IOError:
b25042f
             log.error('locale file: %s not found.', resource_path)
b25042f
+
b25042f
+        resource_path2 = os.path.join(sysconfig.get_config_var('datarootdir'), 'locale', lang, 'LC_MESSAGES', '%s.mo' % domain)
b25042f
+        try:
b25042f
+            with open(resource_path2, mode = 'rb') as fp:
b25042f
+                translation = gettext.GNUTranslations(fp)
b25042f
+            break
b25042f
+        except IOError:
b25042f
+            log.error('locale file: %s not found.', resource_path2)
b25042f
     else:
b25042f
         translation = gettext.NullTranslations()
b25042f
 
b25042f
-- 
b25042f
2.23.0
b25042f