[gnome-tweak-tool] Don't translate tweak group names at module load time
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweak-tool] Don't translate tweak group names at module load time
- Date: Sun, 9 Sep 2012 12:14:50 +0000 (UTC)
commit 61147f272fb099955a0df0383ff40c5c80df72f9
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Sat Sep 8 18:12:06 2012 +0200
Don't translate tweak group names at module load time
When the modules are loaded, the gettext infrastructure is not ready,
and therefore the names don't get translated.
https://bugzilla.gnome.org/show_bug.cgi?id=683630
gtweak/tweakmodel.py | 17 ++++++++++-------
gtweak/tweaks/tweak_shell_extensions.py | 4 +++-
2 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/gtweak/tweakmodel.py b/gtweak/tweakmodel.py
index dd40743..d1b0662 100644
--- a/gtweak/tweakmodel.py
+++ b/gtweak/tweakmodel.py
@@ -18,19 +18,22 @@
import logging
import glob
import os.path
+import gettext
import gtweak
from gi.repository import Gtk
-TWEAK_GROUP_FONTS = _("Fonts")
-TWEAK_GROUP_THEME = _("Theme")
-TWEAK_GROUP_DESKTOP = _("Desktop")
-TWEAK_GROUP_WINDOWS = _("Windows")
-TWEAK_GROUP_SHELL = _("Shell")
+def N_(x): return x
+
+TWEAK_GROUP_FONTS = N_("Fonts")
+TWEAK_GROUP_THEME = N_("Theme")
+TWEAK_GROUP_DESKTOP = N_("Desktop")
+TWEAK_GROUP_WINDOWS = N_("Windows")
+TWEAK_GROUP_SHELL = N_("Shell")
#translate this the same as the name of the file manager (nautilus)
-TWEAK_GROUP_FILES = _("Files")
+TWEAK_GROUP_FILES = N_("Files")
TWEAK_SORT_FIRST = -1e3
TWEAK_SORT_LAST = 1e3
@@ -156,7 +159,7 @@ class TweakModel(Gtk.ListStore):
LOG.critical("Tweak group named: %s already exists" % tweakgroup.name)
return
- _iter = self.append([tweakgroup.name, tweakgroup])
+ _iter = self.append([gettext.gettext(tweakgroup.name), tweakgroup])
self._tweak_group_names[tweakgroup.name] = tweakgroup
self._tweak_group_iters[tweakgroup.name] = _iter
diff --git a/gtweak/tweaks/tweak_shell_extensions.py b/gtweak/tweaks/tweak_shell_extensions.py
index 1a3f627..9123e02 100644
--- a/gtweak/tweaks/tweak_shell_extensions.py
+++ b/gtweak/tweaks/tweak_shell_extensions.py
@@ -12,6 +12,8 @@ from gtweak.gshellwrapper import GnomeShell, GnomeShellFactory
from gtweak.tweakmodel import Tweak, TweakGroup
from gtweak.widgets import ZipFileChooserButton, build_label_beside_widget, build_horizontal_sizegroup, build_tight_button, UI_BOX_SPACING
+def N_(x): return x
+
class _ShellExtensionTweak(Tweak):
def __init__(self, shell, ext, **options):
@@ -157,7 +159,7 @@ class _ShellExtensionInstallerTweak(Tweak):
class ShellExtensionTweakGroup(TweakGroup):
def __init__(self):
- TweakGroup.__init__(self, _("Shell Extensions"))
+ TweakGroup.__init__(self, N_("Shell Extensions"))
extension_tweaks = []
sg = build_horizontal_sizegroup()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]