[gnome-dvb-daemon] Don't bind gettext domain globally to avoid interfering with applications that import gnomedvb
- From: Sebastian Polsterl <sebp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-dvb-daemon] Don't bind gettext domain globally to avoid interfering with applications that import gnomedvb
- Date: Fri, 19 Aug 2011 17:10:25 +0000 (UTC)
commit 98592ea438023580e20ba5fd5602a83ed2e8334c
Author: Sebastian PÃlsterl <sebp k-d-w org>
Date: Fri Aug 19 19:08:22 2011 +0200
Don't bind gettext domain globally to avoid interfering with applications that import gnomedvb
client/gnome-dvb-control | 2 --
client/gnome-dvb-setup | 2 --
client/gnomedvb/__init__.py | 19 ++++++++-----------
.../channellisteditor/ChannelListEditorDialog.py | 2 +-
.../ui/controlcenter/ControlCenterWindow.py | 2 +-
client/gnomedvb/ui/preferences/DeviceGroupsView.py | 2 +-
client/gnomedvb/ui/preferences/Dialogs.py | 2 +-
client/gnomedvb/ui/preferences/Preferences.py | 2 +-
client/gnomedvb/ui/recordings/RecordingsDialog.py | 2 +-
client/gnomedvb/ui/timers/CalendarDialog.py | 2 +-
client/gnomedvb/ui/timers/EditTimersDialog.py | 2 +-
client/gnomedvb/ui/timers/MessageDialogs.py | 2 +-
client/gnomedvb/ui/timers/TimerDialog.py | 2 +-
client/gnomedvb/ui/widgets/ChannelGroupsView.py | 2 +-
client/gnomedvb/ui/widgets/ChannelsStore.py | 2 +-
client/gnomedvb/ui/widgets/ChannelsView.py | 2 +-
client/gnomedvb/ui/widgets/DateTime.py | 2 +-
client/gnomedvb/ui/widgets/DetailsDialog.py | 2 +-
client/gnomedvb/ui/widgets/RecordingsView.py | 2 +-
client/gnomedvb/ui/widgets/RunningNextView.py | 2 +-
client/gnomedvb/ui/widgets/ScheduleView.py | 2 +-
client/gnomedvb/ui/wizard/SetupWizard.py | 2 +-
client/gnomedvb/ui/wizard/__init__.py | 2 +-
client/gnomedvb/ui/wizard/pages/AdaptersPage.py | 2 +-
client/gnomedvb/ui/wizard/pages/ChannelScanPage.py | 2 +-
.../ui/wizard/pages/InitialTuningDataPage.py | 2 +-
client/gnomedvb/ui/wizard/pages/IntroPage.py | 2 +-
.../ui/wizard/pages/SaveChannelListPage.py | 2 +-
client/gnomedvb/ui/wizard/pages/SetupDevicePage.py | 2 +-
client/gnomedvb/ui/wizard/pages/SummaryPage.py | 2 +-
30 files changed, 35 insertions(+), 42 deletions(-)
---
diff --git a/client/gnome-dvb-control b/client/gnome-dvb-control
index f61e33c..252d99e 100644
--- a/client/gnome-dvb-control
+++ b/client/gnome-dvb-control
@@ -22,8 +22,6 @@ import gnomedvb
from gnomedvb.ui.controlcenter.ControlCenterWindow import ControlCenterWindow
from gnomedvb.DVBModel import DVBModel
-gnomedvb.setup_i18n()
-
model = DVBModel()
w = ControlCenterWindow(model)
w.show_all()
diff --git a/client/gnome-dvb-setup b/client/gnome-dvb-setup
index b99ba59..0cdf252 100644
--- a/client/gnome-dvb-setup
+++ b/client/gnome-dvb-setup
@@ -22,8 +22,6 @@ from gi.repository import Gtk, Gdk
from gnomedvb.ui.wizard.SetupWizard import SetupWizard
from optparse import OptionParser
-gnomedvb.setup_i18n()
-
parser = OptionParser()
parser.add_option("--transient-for", dest="transient_for", type="long",
help="XID of parent window")
diff --git a/client/gnomedvb/__init__.py b/client/gnomedvb/__init__.py
index c0c08fe..20c6db7 100644
--- a/client/gnomedvb/__init__.py
+++ b/client/gnomedvb/__init__.py
@@ -23,9 +23,13 @@ import gnomedvb.userdirs
import gettext
from gi.repository import Gtk
import os
-from gettext import gettext as _
+import gettext
from os.path import abspath, join, expanduser
+# Setup i18n
+t = gettext.translation(gnomedvb.defs.PACKAGE, fallback=True)
+_ = t.gettext
+
INFOS = {
"authors": ["Sebastian PÃlsterl <sebp k-d-w org>"],
"copyright" : "Copyright  2008-2011\nSebastian PÃlsterl.",
@@ -39,13 +43,6 @@ INFOS = {
_home = os.environ.get('HOME', '/')
XDG_CONFIG_HOME = os.environ.get('XDG_CONFIG_HOME', join(_home, '.config'))
-def setup_i18n():
- # Setup i18n
- gettext.bindtextdomain(gnomedvb.defs.PACKAGE)
- if hasattr(gettext, 'bind_textdomain_codeset'):
- gettext.bind_textdomain_codeset(gnomedvb.defs.PACKAGE, 'UTF-8')
- gettext.textdomain(gnomedvb.defs.PACKAGE)
-
def get_config_dir():
return join(XDG_CONFIG_HOME, gnomedvb.defs.PACKAGE)
@@ -62,10 +59,10 @@ def seconds_to_time_duration_string(duration):
seconds = duration % 60
text = []
if hours != 0:
- text.append(gettext.ngettext("%d hour", "%d hours", hours) % hours)
+ text.append(t.ngettext("%d hour", "%d hours", hours) % hours)
if minutes != 0:
- text.append(gettext.ngettext("%d minute", "%d minutes", minutes) % minutes)
+ text.append(t.ngettext("%d minute", "%d minutes", minutes) % minutes)
if seconds != 0:
- text.append(gettext.ngettext("%d second", "%d seconds", seconds) % seconds)
+ text.append(t.ngettext("%d second", "%d seconds", seconds) % seconds)
return " ".join(text)
diff --git a/client/gnomedvb/ui/channellisteditor/ChannelListEditorDialog.py b/client/gnomedvb/ui/channellisteditor/ChannelListEditorDialog.py
index 7d0bdb1..6555073 100644
--- a/client/gnomedvb/ui/channellisteditor/ChannelListEditorDialog.py
+++ b/client/gnomedvb/ui/channellisteditor/ChannelListEditorDialog.py
@@ -19,7 +19,7 @@
import gnomedvb
from gi.repository import GObject
from gi.repository import Gtk
-from gettext import gettext as _
+from gnomedvb import _
from gnomedvb.ui.widgets.ChannelsStore import ChannelsStore
from gnomedvb.ui.widgets.ChannelsView import ChannelsView
from gnomedvb.ui.widgets.ChannelGroupsStore import ChannelGroupsStore
diff --git a/client/gnomedvb/ui/controlcenter/ControlCenterWindow.py b/client/gnomedvb/ui/controlcenter/ControlCenterWindow.py
index d5607ca..005cd35 100644
--- a/client/gnomedvb/ui/controlcenter/ControlCenterWindow.py
+++ b/client/gnomedvb/ui/controlcenter/ControlCenterWindow.py
@@ -19,7 +19,7 @@
from gi.repository import Gdk
from gi.repository import Gtk
from gi.repository import GObject
-from gettext import gettext as _
+from gnomedvb import _
import gnomedvb
from gnomedvb.ui.widgets.ChannelsStore import ChannelsStore
from gnomedvb.ui.widgets.ChannelsView import ChannelsView
diff --git a/client/gnomedvb/ui/preferences/DeviceGroupsView.py b/client/gnomedvb/ui/preferences/DeviceGroupsView.py
index ea09d10..cb434a5 100644
--- a/client/gnomedvb/ui/preferences/DeviceGroupsView.py
+++ b/client/gnomedvb/ui/preferences/DeviceGroupsView.py
@@ -18,7 +18,7 @@
from gi.repository import Gtk
from gi.repository import GObject
-from gettext import gettext as _
+from gnomedvb import _
from gnomedvb.Device import Device
__all__ = ["UnassignedDevicesStore", "DeviceGroupsStore", "DeviceGroupsView"]
diff --git a/client/gnomedvb/ui/preferences/Dialogs.py b/client/gnomedvb/ui/preferences/Dialogs.py
index 840d87a..fdaf607 100644
--- a/client/gnomedvb/ui/preferences/Dialogs.py
+++ b/client/gnomedvb/ui/preferences/Dialogs.py
@@ -18,7 +18,7 @@
from gi.repository import Gtk
from gi.repository import GObject
-from gettext import gettext as _
+from gnomedvb import _
from gnomedvb.ui.widgets.Frame import BaseFrame, TextFieldLabel
__all__ = ["AddToGroupDialog", "NewGroupDialog", "EditGroupDialog"]
diff --git a/client/gnomedvb/ui/preferences/Preferences.py b/client/gnomedvb/ui/preferences/Preferences.py
index bf64c37..15ccafd 100644
--- a/client/gnomedvb/ui/preferences/Preferences.py
+++ b/client/gnomedvb/ui/preferences/Preferences.py
@@ -23,7 +23,7 @@ from gnomedvb import global_error_handler
from gnomedvb.ui.preferences.Dialogs import *
from gnomedvb.ui.preferences.DeviceGroupsView import *
from gnomedvb.ui.widgets.Frame import Frame
-from gettext import gettext as _
+from gnomedvb import _
from gnomedvb.Device import Device
class Preferences(Gtk.Window):
diff --git a/client/gnomedvb/ui/recordings/RecordingsDialog.py b/client/gnomedvb/ui/recordings/RecordingsDialog.py
index f0ecfd5..e86ef12 100644
--- a/client/gnomedvb/ui/recordings/RecordingsDialog.py
+++ b/client/gnomedvb/ui/recordings/RecordingsDialog.py
@@ -18,7 +18,7 @@
from gi.repository import Gdk
from gi.repository import Gtk
-from gettext import gettext as _
+from gnomedvb import _
from gnomedvb import global_error_handler
from gnomedvb.ui.widgets.RecordingsStore import RecordingsStore
diff --git a/client/gnomedvb/ui/timers/CalendarDialog.py b/client/gnomedvb/ui/timers/CalendarDialog.py
index 4d1648d..ebda333 100644
--- a/client/gnomedvb/ui/timers/CalendarDialog.py
+++ b/client/gnomedvb/ui/timers/CalendarDialog.py
@@ -17,7 +17,7 @@
# along with GNOME DVB Daemon. If not, see <http://www.gnu.org/licenses/>.
from gi.repository import Gtk
-from gettext import gettext as _
+from gnomedvb import _
class CalendarDialog(Gtk.Dialog):
diff --git a/client/gnomedvb/ui/timers/EditTimersDialog.py b/client/gnomedvb/ui/timers/EditTimersDialog.py
index 1789bd7..8976318 100644
--- a/client/gnomedvb/ui/timers/EditTimersDialog.py
+++ b/client/gnomedvb/ui/timers/EditTimersDialog.py
@@ -18,7 +18,7 @@
from gi.repository import GObject
from gi.repository import Gtk
-from gettext import gettext as _
+from gnomedvb import _
import datetime
import gnomedvb
from gnomedvb import global_error_handler
diff --git a/client/gnomedvb/ui/timers/MessageDialogs.py b/client/gnomedvb/ui/timers/MessageDialogs.py
index a693bb3..0fc04cc 100644
--- a/client/gnomedvb/ui/timers/MessageDialogs.py
+++ b/client/gnomedvb/ui/timers/MessageDialogs.py
@@ -17,7 +17,7 @@
# along with GNOME DVB Daemon. If not, see <http://www.gnu.org/licenses/>.
from gi.repository import Gtk
-from gettext import gettext as _
+from gnomedvb import _
class TimerFailureDialog(Gtk.MessageDialog):
diff --git a/client/gnomedvb/ui/timers/TimerDialog.py b/client/gnomedvb/ui/timers/TimerDialog.py
index c520375..35a5629 100644
--- a/client/gnomedvb/ui/timers/TimerDialog.py
+++ b/client/gnomedvb/ui/timers/TimerDialog.py
@@ -18,7 +18,7 @@
import datetime
from gi.repository import Gtk
-from gettext import gettext as _
+from gnomedvb import _
from gnomedvb.ui.widgets.ChannelsStore import ChannelsStore
from gnomedvb.ui.widgets.ChannelsView import ChannelsView
from gnomedvb.ui.widgets.Frame import TextFieldLabel
diff --git a/client/gnomedvb/ui/widgets/ChannelGroupsView.py b/client/gnomedvb/ui/widgets/ChannelGroupsView.py
index bc5db6f..0e597d9 100644
--- a/client/gnomedvb/ui/widgets/ChannelGroupsView.py
+++ b/client/gnomedvb/ui/widgets/ChannelGroupsView.py
@@ -18,7 +18,7 @@
from gi.repository import GObject
from gi.repository import Gtk
-from gettext import gettext as _
+from gnomedvb import _
from gnomedvb.ui.widgets.ChannelGroupsStore import ChannelGroupsStore
class ChannelGroupsView(Gtk.TreeView):
diff --git a/client/gnomedvb/ui/widgets/ChannelsStore.py b/client/gnomedvb/ui/widgets/ChannelsStore.py
index c106813..a213784 100644
--- a/client/gnomedvb/ui/widgets/ChannelsStore.py
+++ b/client/gnomedvb/ui/widgets/ChannelsStore.py
@@ -22,7 +22,7 @@ import gnomedvb
from gnomedvb import global_error_handler
from gnomedvb.Callback import Callback
from cgi import escape
-from gettext import gettext as _
+from gnomedvb import _
class ChannelsStore(Gtk.ListStore):
diff --git a/client/gnomedvb/ui/widgets/ChannelsView.py b/client/gnomedvb/ui/widgets/ChannelsView.py
index fb4b0f1..c8a417a 100644
--- a/client/gnomedvb/ui/widgets/ChannelsView.py
+++ b/client/gnomedvb/ui/widgets/ChannelsView.py
@@ -18,7 +18,7 @@
from gi.repository import GObject
from gi.repository import Gtk
-from gettext import gettext as _
+from gnomedvb import _
from gnomedvb.ui.widgets.ChannelsStore import ChannelsStore, ChannelsTreeStore
diff --git a/client/gnomedvb/ui/widgets/DateTime.py b/client/gnomedvb/ui/widgets/DateTime.py
index e1291bb..ddde4a6 100644
--- a/client/gnomedvb/ui/widgets/DateTime.py
+++ b/client/gnomedvb/ui/widgets/DateTime.py
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with GNOME DVB Daemon. If not, see <http://www.gnu.org/licenses/>.
-from gettext import gettext as _
+from gnomedvb import _
from gi.repository import GObject
from gi.repository import Gdk
from gi.repository import Gtk
diff --git a/client/gnomedvb/ui/widgets/DetailsDialog.py b/client/gnomedvb/ui/widgets/DetailsDialog.py
index 035853d..16457c8 100644
--- a/client/gnomedvb/ui/widgets/DetailsDialog.py
+++ b/client/gnomedvb/ui/widgets/DetailsDialog.py
@@ -19,7 +19,7 @@
import datetime
from gi.repository import Gtk
import gnomedvb
-from gettext import gettext as _
+from gnomedvb import _
from gnomedvb.ui.widgets.Frame import TextFieldLabel
class DetailsDialog(Gtk.Dialog):
diff --git a/client/gnomedvb/ui/widgets/RecordingsView.py b/client/gnomedvb/ui/widgets/RecordingsView.py
index 5bbe463..ff42d6e 100644
--- a/client/gnomedvb/ui/widgets/RecordingsView.py
+++ b/client/gnomedvb/ui/widgets/RecordingsView.py
@@ -18,7 +18,7 @@
from gi.repository import GObject
from gi.repository import Gtk
-from gettext import gettext as _
+from gnomedvb import _
from gnomedvb import seconds_to_time_duration_string
from gnomedvb.ui.widgets.RecordingsStore import RecordingsStore
diff --git a/client/gnomedvb/ui/widgets/RunningNextView.py b/client/gnomedvb/ui/widgets/RunningNextView.py
index e0f33cd..6d6c526 100644
--- a/client/gnomedvb/ui/widgets/RunningNextView.py
+++ b/client/gnomedvb/ui/widgets/RunningNextView.py
@@ -20,7 +20,7 @@ import datetime
from gi.repository import GObject
from gi.repository import Gdk
from gi.repository import Gtk
-from gettext import gettext as _
+from gnomedvb import _
from gnomedvb import global_error_handler
from gnomedvb.ui.widgets.RunningNextStore import RunningNextStore
from gnomedvb.ui.widgets.DetailsDialog import DetailsDialog
diff --git a/client/gnomedvb/ui/widgets/ScheduleView.py b/client/gnomedvb/ui/widgets/ScheduleView.py
index 5ce7f5b..a937907 100644
--- a/client/gnomedvb/ui/widgets/ScheduleView.py
+++ b/client/gnomedvb/ui/widgets/ScheduleView.py
@@ -19,7 +19,7 @@
from gi.repository import GObject
from gi.repository import Gtk
from gi.repository import Pango
-from gettext import gettext as _
+from gnomedvb import _
from gnomedvb import seconds_to_time_duration_string
from gnomedvb.ui.widgets.ScheduleStore import ScheduleStore
from gnomedvb.ui.widgets.CellRendererDatetime import CellRendererDatetime
diff --git a/client/gnomedvb/ui/wizard/SetupWizard.py b/client/gnomedvb/ui/wizard/SetupWizard.py
index 73ab83b..0ad0a08 100644
--- a/client/gnomedvb/ui/wizard/SetupWizard.py
+++ b/client/gnomedvb/ui/wizard/SetupWizard.py
@@ -19,7 +19,7 @@
import gnomedvb
from gi.repository import GObject
from gi.repository import Gtk
-from gettext import gettext as _
+from gnomedvb import _
from gnomedvb.DVBModel import DVBModel
from gnomedvb.ui.wizard.pages.IntroPage import IntroPage
from gnomedvb.ui.wizard.pages.AdaptersPage import AdaptersPage
diff --git a/client/gnomedvb/ui/wizard/__init__.py b/client/gnomedvb/ui/wizard/__init__.py
index 50662c0..ce6ac89 100644
--- a/client/gnomedvb/ui/wizard/__init__.py
+++ b/client/gnomedvb/ui/wizard/__init__.py
@@ -1,4 +1,4 @@
-from gettext import gettext as _
+from gnomedvb import _
DVB_TYPE_TO_DESC = {
"DVB-C": _("digital cable"),
diff --git a/client/gnomedvb/ui/wizard/pages/AdaptersPage.py b/client/gnomedvb/ui/wizard/pages/AdaptersPage.py
index 6e35632..b1da94a 100644
--- a/client/gnomedvb/ui/wizard/pages/AdaptersPage.py
+++ b/client/gnomedvb/ui/wizard/pages/AdaptersPage.py
@@ -19,7 +19,7 @@
from gi.repository import GObject
import gnomedvb
from gi.repository import Gtk
-from gettext import gettext as _
+from gnomedvb import _
from gnomedvb.ui.wizard import DVB_TYPE_TO_DESC
from gnomedvb.ui.wizard.pages.BasePage import BasePage
from gnomedvb.ui.widgets.Frame import BaseFrame
diff --git a/client/gnomedvb/ui/wizard/pages/ChannelScanPage.py b/client/gnomedvb/ui/wizard/pages/ChannelScanPage.py
index 0006f3e..a8ffde5 100644
--- a/client/gnomedvb/ui/wizard/pages/ChannelScanPage.py
+++ b/client/gnomedvb/ui/wizard/pages/ChannelScanPage.py
@@ -19,7 +19,7 @@
from gi.repository import GdkPixbuf
from gi.repository import Gtk
from gi.repository import GObject
-from gettext import gettext as _
+from gnomedvb import _
from gnomedvb.ui.wizard.pages.BasePage import BasePage
from gnomedvb.ui.widgets.Frame import TextFieldLabel
from gnomedvb import global_error_handler
diff --git a/client/gnomedvb/ui/wizard/pages/InitialTuningDataPage.py b/client/gnomedvb/ui/wizard/pages/InitialTuningDataPage.py
index 7e04420..973477c 100644
--- a/client/gnomedvb/ui/wizard/pages/InitialTuningDataPage.py
+++ b/client/gnomedvb/ui/wizard/pages/InitialTuningDataPage.py
@@ -24,7 +24,7 @@ from gi.repository import GLib
from gi.repository import GObject
import gettext
import locale
-from gettext import gettext as _
+from gnomedvb import _
from gnomedvb.ui.wizard.pages.BasePage import BasePage
DVB_APPS_DIRS = ("/usr/share/dvb",
diff --git a/client/gnomedvb/ui/wizard/pages/IntroPage.py b/client/gnomedvb/ui/wizard/pages/IntroPage.py
index 8090c36..c5f945d 100644
--- a/client/gnomedvb/ui/wizard/pages/IntroPage.py
+++ b/client/gnomedvb/ui/wizard/pages/IntroPage.py
@@ -17,7 +17,7 @@
# along with GNOME DVB Daemon. If not, see <http://www.gnu.org/licenses/>.
from gi.repository import Gtk
-from gettext import gettext as _
+from gnomedvb import _
from gnomedvb.ui.wizard.pages.BasePage import BasePage
class IntroPage(BasePage):
diff --git a/client/gnomedvb/ui/wizard/pages/SaveChannelListPage.py b/client/gnomedvb/ui/wizard/pages/SaveChannelListPage.py
index b94d3c9..3238b58 100644
--- a/client/gnomedvb/ui/wizard/pages/SaveChannelListPage.py
+++ b/client/gnomedvb/ui/wizard/pages/SaveChannelListPage.py
@@ -18,7 +18,7 @@
from gi.repository import Gtk
from gi.repository import GObject
-from gettext import gettext as _
+from gnomedvb import _
from gnomedvb.ui.wizard.pages.BasePage import BasePage
class SaveChannelListPage(BasePage):
diff --git a/client/gnomedvb/ui/wizard/pages/SetupDevicePage.py b/client/gnomedvb/ui/wizard/pages/SetupDevicePage.py
index 4fd7a51..d8d4f06 100644
--- a/client/gnomedvb/ui/wizard/pages/SetupDevicePage.py
+++ b/client/gnomedvb/ui/wizard/pages/SetupDevicePage.py
@@ -20,7 +20,7 @@ from gi.repository import GObject
import gnomedvb
from gi.repository import Gtk
import os.path
-from gettext import gettext as _
+from gnomedvb import _
from gnomedvb.ui.wizard import DVB_TYPE_TO_DESC
from gnomedvb.ui.wizard.pages.BasePage import BasePage
diff --git a/client/gnomedvb/ui/wizard/pages/SummaryPage.py b/client/gnomedvb/ui/wizard/pages/SummaryPage.py
index be8a0f6..33254a3 100644
--- a/client/gnomedvb/ui/wizard/pages/SummaryPage.py
+++ b/client/gnomedvb/ui/wizard/pages/SummaryPage.py
@@ -17,7 +17,7 @@
# along with GNOME DVB Daemon. If not, see <http://www.gnu.org/licenses/>.
from gi.repository import Gtk
-from gettext import gettext as _
+from gnomedvb import _
from gnomedvb.ui.wizard.pages.BasePage import BasePage
class SummaryPage(BasePage):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]