[gnome-todo/gnome-3-26] Merge branch 'wip/piotrdrag/untranslated-python' into 'master'



commit ccaadfc0cb12963650848fd3e71493a2c90c34cd
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sun Feb 11 17:12:23 2018 +0000

    Merge branch 'wip/piotrdrag/untranslated-python' into 'master'
    
    plugins: Fix gettext import in Python files
    
    Closes #140
    
    See merge request GNOME/gnome-todo!26
    
    (cherry picked from commit 5fcee7db1bced84d14028ed86c315e9136e4f374)
    
    bf9aab4b plugins: Fix gettext import in Python files

 plugins/score/score/__init__.py                         | 8 +++++++-
 plugins/unscheduled-panel/unscheduled-panel/__init__.py | 8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/plugins/score/score/__init__.py b/plugins/score/score/__init__.py
index 6bf7a94..d289f3c 100644
--- a/plugins/score/score/__init__.py
+++ b/plugins/score/score/__init__.py
@@ -24,7 +24,13 @@ gi.require_version('Peas', '1.0')
 
 from gi.repository import Gio, GLib, GObject, Gtd, Gtk, Peas
 
-from gettext import gettext as _
+try:
+    import gettext
+    gettext.bindtextdomain('gnome-todo')
+    gettext.textdomain('gnome-todo')
+    _ = gettext.gettext
+except:
+    _ = lambda s: s
 
 
 class ScoreManager(GObject.Object):
diff --git a/plugins/unscheduled-panel/unscheduled-panel/__init__.py 
b/plugins/unscheduled-panel/unscheduled-panel/__init__.py
index 9dbd5e7..dc6fcfb 100644
--- a/plugins/unscheduled-panel/unscheduled-panel/__init__.py
+++ b/plugins/unscheduled-panel/unscheduled-panel/__init__.py
@@ -24,7 +24,13 @@ gi.require_version('Peas', '1.0')
 
 from gi.repository import Gio, GLib, GObject, Gtd, Gtk, Peas
 
-from gettext import gettext as _
+try:
+    import gettext
+    gettext.bindtextdomain('gnome-todo')
+    gettext.textdomain('gnome-todo')
+    _ = gettext.gettext
+except:
+    _ = lambda s: s
 
 
 class UnscheduledPanel(Gtk.Box, Gtd.Panel):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]