From 242b49e103dce92d3ee2b255e917a5f50a4ce20b Mon Sep 17 00:00:00 2001
From: Simon Schampijer <simon@schampijer.de>
Date: Mon, 4 Jun 2012 17:48:13 +0200
Subject: [PATCH sugar-toolkit] Move the translation initialisation to an
earlier stage, SL #3654
To not depend on gconf at this stage the shell does set
an env variable when reading the GConf key. This is handled
in sugar-activity deployed by the sugar-toolkit-gtk3.
Signed-off-by: Simon Schampijer <simon@laptop.org>
---
src/sugar/activity/activity.py | 6 ------
src/sugar/activity/i18n.py | 8 ++------
2 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py
index 34e9729..affe9c9 100644
a
|
b
|
class Activity(Window, gtk.Container): |
261 | 261 | """ |
262 | 262 | |
263 | 263 | # Stuff that needs to be done early |
264 | | |
265 | | locale_path = i18n.get_locale_path(self.get_bundle_id()) |
266 | | gettext.bindtextdomain(self.get_bundle_id(), locale_path) |
267 | | gettext.bindtextdomain('sugar-toolkit', sugar.locale_path) |
268 | | gettext.textdomain(self.get_bundle_id()) |
269 | | |
270 | 264 | icons_path = os.path.join(get_bundle_path(), 'icons') |
271 | 265 | gtk.icon_theme_get_default().append_search_path(icons_path) |
272 | 266 | |
diff --git a/src/sugar/activity/i18n.py b/src/sugar/activity/i18n.py
index 1ddbd79..f179992 100644
a
|
b
|
|
17 | 17 | # Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | 18 | # Boston, MA 02111-1307, USA. |
19 | 19 | |
20 | | import gconf |
21 | | |
22 | 20 | from gettext import gettext |
23 | 21 | import locale |
24 | 22 | import os |
… |
… |
def get_locale_path(bundle_id): |
135 | 133 | if 'SUGAR_LOCALEDIR' in os.environ: |
136 | 134 | candidate_dirs[os.environ['SUGAR_LOCALEDIR']] = 2 |
137 | 135 | |
138 | | gconf_client = gconf.client_get_default() |
139 | | package_dir = gconf_client.get_string('/desktop/sugar/i18n/langpackdir') |
140 | | if package_dir is not None and package_dir is not '': |
141 | | candidate_dirs[package_dir] = 1 |
| 136 | if 'SUGAR_LANGPACKDIR' in os.environ: |
| 137 | candidate_dirs[os.environ['SUGAR_LANGPACKDIR']] = 1 |
142 | 138 | |
143 | 139 | candidate_dirs[os.path.join(sys.prefix, 'share', 'locale')] = 0 |
144 | 140 | |