Added localized gettext for registration code

svn: r13490
This commit is contained in:
Doug Blank 2009-11-03 13:42:37 +00:00
parent 98ec7731e7
commit 8143ef6c18

View File

@ -41,6 +41,7 @@ from gettext import gettext as _
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from const import VERSION as GRAMPSVERSION from const import VERSION as GRAMPSVERSION
from TransUtils import get_addon_translator
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -55,7 +56,8 @@ STATUS = [STABLE, UNSTABLE]
STATUSTEXT = {STABLE: _('Stable'), UNSTABLE: _('Unstable')} STATUSTEXT = {STABLE: _('Stable'), UNSTABLE: _('Unstable')}
#possible plugin types #possible plugin types
REPORT = 0 REPORT = 0
QUICKREPORT = 1 QUICKREPORT = 1 # deprecated
QUICKVIEW = 1
TOOL = 2 TOOL = 2
IMPORT = 3 IMPORT = 3
EXPORT = 4 EXPORT = 4
@ -752,9 +754,11 @@ class PluginRegister(object):
if not name[extlen:] == ext: if not name[extlen:] == ext:
continue continue
lenpd = len(self.__plugindata) lenpd = len(self.__plugindata)
full_filename = os.path.join(dir, filename)
local_gettext = get_addon_translator(full_filename).gettext
try: try:
execfile(os.path.join(dir, filename), execfile(full_filename,
{'_': _, {'_': local_gettext,
'newplugin': newplugin, 'newplugin': newplugin,
'register': register, 'register': register,
'STABLE': STABLE, 'STABLE': STABLE,
@ -797,7 +801,6 @@ class PluginRegister(object):
'TOOL_MODE_GUI': TOOL_MODE_GUI, 'TOOL_MODE_GUI': TOOL_MODE_GUI,
'TOOL_MODE_CLI': TOOL_MODE_CLI, 'TOOL_MODE_CLI': TOOL_MODE_CLI,
'GRAMPSVERSION': GRAMPSVERSION, 'GRAMPSVERSION': GRAMPSVERSION,
'__file__': os.path.join(dir, filename),
}, },
{}) {})
except ValueError, msg: except ValueError, msg: