diff --git a/plugins/acronyms_expander/acronyms_expander.py b/plugins/acronyms_expander/acronyms_expander.py index 919f1a12c49d5c3ecc88e0f163bd402595d51247..e325f67bf0a4c85f1b19e23bd101cad045195d18 100644 --- a/plugins/acronyms_expander/acronyms_expander.py +++ b/plugins/acronyms_expander/acronyms_expander.py @@ -44,7 +44,7 @@ class AcronymsExpanderPlugin(GajimPlugin): } self.config_default_values = { - 'INVOKER': (' ', _('')), + 'INVOKER': (' ', ''), 'ACRONYMS': ({'RTFM': 'Read The Friendly Manual', '/slap': '/me slaps', 'PS-': 'plug-in system', @@ -53,7 +53,7 @@ class AcronymsExpanderPlugin(GajimPlugin): 'GW-': 'http://trac.gajim.org/', 'GTS-': 'http://trac.gajim.org/report', }, - _('')), + ''), } @log_calls('AcronymsExpanderPlugin') diff --git a/plugins/plugin_installer/plugin_installer.py b/plugins/plugin_installer/plugin_installer.py index b78572f6359d66733e9ed26d1a3e41bf52bc7325..ee0a744cf77d72cfa398fe3ffa8e36cd62c35107 100644 --- a/plugins/plugin_installer/plugin_installer.py +++ b/plugins/plugin_installer/plugin_installer.py @@ -35,7 +35,6 @@ from plugins import GajimPlugin 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 @@ class PluginInstaller(GajimPlugin): 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 @@ class PluginInstaller(GajimPlugin): 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 --git a/src/plugins/gui.py b/src/plugins/gui.py index d095b3da336ff38639f55bf66018492855180f11..c24aa98de663086361fcedc9d58665c88f0e6de8 100644 --- a/src/plugins/gui.py +++ b/src/plugins/gui.py @@ -113,7 +113,8 @@ class PluginsWindow(object): 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 --git a/src/plugins/pluginmanager.py b/src/plugins/pluginmanager.py index f80e5f99171bd38bf1d44e9ab3a41d9a2b689d1b..e71042189b4d5df30c41a9a9d985a70abf197c69 100644 --- a/src/plugins/pluginmanager.py +++ b/src/plugins/pluginmanager.py @@ -393,6 +393,7 @@ class PluginManager(object): :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 @@ class PluginManager(object): 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 --git a/src/plugins/plugins_i18n.py b/src/plugins/plugins_i18n.py new file mode 100644 index 0000000000000000000000000000000000000000..23e851e7e7aa1aa900fd20fa9921e1dc8c7dfe28 --- /dev/null +++ b/src/plugins/plugins_i18n.py @@ -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