imported patch 2011-08-27_00-06-54_r13163+.diff

This commit is contained in:
Denis Fomin 2011-08-30 15:23:16 +03:00
parent 7bdacfaa04
commit e194394479
5 changed files with 49 additions and 6 deletions

View File

@ -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')

View File

@ -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()

View File

@ -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__)

View File

@ -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

View File

@ -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