changeset 0baf415e9f18 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=0baf415e9f18
description: imported patch 2011-08-27_00-06-54_r13163+.diff
diffstat:
plugins/acronyms_expander/acronyms_expander.py | 4 +-
plugins/plugin_installer/plugin_installer.py | 5 +--
src/plugins/gui.py | 3 +-
src/plugins/pluginmanager.py | 4 ++
src/plugins/plugins_i18n.py | 39 ++++++++++++++++++++++++++
5 files changed, 49 insertions(+), 6 deletions(-)
diffs (127 lines):
diff -r b5ed365da181 -r 0baf415e9f18
plugins/acronyms_expander/acronyms_expander.py
--- a/plugins/acronyms_expander/acronyms_expander.py Mon Aug 29 15:08:04
2011 +0200
+++ b/plugins/acronyms_expander/acronyms_expander.py Tue Aug 30 15:23:16
2011 +0300
@@ -44,7 +44,7 @@
}
self.config_default_values = {
- 'INVOKER': (' ', _('')),
+ 'INVOKER': (' ', ''),
'ACRONYMS': ({'RTFM': 'Read The Friendly Manual',
'/slap': '/me slaps',
'PS-': 'plug-in system',
@@ -53,7 +53,7 @@
'GW-': 'http://trac.gajim.org/',
'GTS-': 'http://trac.gajim.org/report',
},
- _('')),
+ ''),
}
@log_calls('AcronymsExpanderPlugin')
diff -r b5ed365da181 -r 0baf415e9f18
plugins/plugin_installer/plugin_installer.py
--- a/plugins/plugin_installer/plugin_installer.py Mon Aug 29 15:08:04
2011 +0200
+++ b/plugins/plugin_installer/plugin_installer.py Tue Aug 30 15:23:16
2011 +0300
@@ -35,7 +35,6 @@
from plugins.helpers import log_calls, log
from dialogs import WarningDialog, HigDialog
from plugins.gui import GajimPluginConfigDialog
-from common import i18n
class PluginInstaller(GajimPlugin):
@@ -74,7 +73,7 @@
self.window.connect('destroy', self.on_win_destroy)
self.GTK_BUILDER_FILE_PATH = self.local_file_path('config_dialog.ui')
self.xml = gtk.Builder()
- self.xml.set_translation_domain(i18n.APP)
+ self.xml.set_translation_domain('gajim_plugins')
self.xml.add_objects_from_file(self.GTK_BUILDER_FILE_PATH, ['hpaned2'])
hpaned = self.xml.get_object('hpaned2')
self.page_num = self.notebook.append_page(hpaned,
@@ -228,7 +227,7 @@
label.set_ellipsize(pango.ELLIPSIZE_END)
self.plugin_homepage_linkbutton1.set_property('sensitive', True)
desc_textbuffer = self.plugin_description_textview1.get_buffer()
- desc_textbuffer.set_text(model.get_value(iter, 5))
+ desc_textbuffer.set_text(_(model.get_value(iter, 5)))
self.plugin_description_textview1.set_property('sensitive', True)
else:
self._clear_available_plugin_info()
diff -r b5ed365da181 -r 0baf415e9f18 src/plugins/gui.py
--- a/src/plugins/gui.py Mon Aug 29 15:08:04 2011 +0200
+++ b/src/plugins/gui.py Tue Aug 30 15:23:16 2011 +0300
@@ -113,7 +113,8 @@
self.plugin_homepage_linkbutton.set_property('sensitive', True)
desc_textbuffer = self.plugin_description_textview.get_buffer()
- desc_textbuffer.set_text(plugin.description)
+ from plugins.plugins_i18n import _
+ desc_textbuffer.set_text(_(plugin.description))
self.plugin_description_textview.set_property('sensitive', True)
self.uninstall_plugin_button.set_property('sensitive',
gajim.PLUGINS_DIRS[1] in plugin.__path__)
diff -r b5ed365da181 -r 0baf415e9f18 src/plugins/pluginmanager.py
--- a/src/plugins/pluginmanager.py Mon Aug 29 15:08:04 2011 +0200
+++ b/src/plugins/pluginmanager.py Tue Aug 30 15:23:16 2011 +0300
@@ -393,6 +393,7 @@
:todo: add scanning packages
:todo: add scanning zipped modules
'''
+ from plugins.plugins_i18n import _
plugins_found = []
conf = ConfigParser.ConfigParser()
fields = ('name', 'short_name', 'version', 'description', 'authors',
@@ -460,6 +461,9 @@
conf.remove_section('info')
plugins_found.append(module_attr)
+ # set plugin localization
+ plugin_module = dir(module)[-1]
+ getattr(module, plugin_module)._ = _
except TypeError, type_error:
pass
diff -r b5ed365da181 -r 0baf415e9f18 src/plugins/plugins_i18n.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/plugins/plugins_i18n.py Tue Aug 30 15:23:16 2011 +0300
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+#
+## src/plugins/plugin_installer/plugins_i18n.py
+##
+## Copyright (C) 2010-2011 Denis Fomin <fominde AT gmail.com>
+##
+## This file is part of Gajim.
+##
+## Gajim is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published
+## by the Free Software Foundation; version 3 only.
+##
+## Gajim is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
+##
+import locale
+import gettext
+from os import path as os_path
+import os
+from common import gajim
+
+APP = 'gajim_plugins'
+plugins_locale_dir = os_path.join(gajim.PLUGINS_DIRS[1], 'locale')
+
+locale.setlocale(locale.LC_ALL, '')
+locale.bindtextdomain(APP, plugins_locale_dir)
+gettext.bindtextdomain(APP, plugins_locale_dir)
+gettext.textdomain(APP)
+try:
+ t = gettext.translation(APP, plugins_locale_dir)
+ _ = t.gettext
+except IOError, msg:
+ from common import i18n
+ _ = gettext.gettext
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits