added domain_register method.
2006-09-15 Sven Neumann <sven@gimp.org> * plug-ins/pygimp/gimpmodule.c: added domain_register method. * plug-ins/pygimp/gimpfu.py: define N_(). Added an optional "domain" parameter to the register() method. Register the domain with GIMP and initialize gettext if it is specified. * plug-ins/pygimp/plug-ins/gimpcons.py: use N_() to mark menu label and blurb for translation. Specify the translation domain. * plug-ins/pygimp/plug-ins/gtkcons.py: use gettext API for modules.
This commit is contained in:

committed by
Sven Neumann

parent
28d825905f
commit
6ee3d9c47e
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
|||||||
|
2006-09-15 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* plug-ins/pygimp/gimpmodule.c: added domain_register method.
|
||||||
|
|
||||||
|
* plug-ins/pygimp/gimpfu.py: define N_(). Added an optional
|
||||||
|
"domain" parameter to the register() method. Register the domain
|
||||||
|
with GIMP and initialize gettext if it is specified.
|
||||||
|
|
||||||
|
* plug-ins/pygimp/plug-ins/gimpcons.py: use N_() to mark menu
|
||||||
|
label and blurb for translation. Specify the translation domain.
|
||||||
|
|
||||||
|
* plug-ins/pygimp/plug-ins/gtkcons.py: use gettext API for modules.
|
||||||
|
|
||||||
2006-09-15 Sven Neumann <sven@gimp.org>
|
2006-09-15 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* plug-ins/pygimp/Makefile.am
|
* plug-ins/pygimp/Makefile.am
|
||||||
|
@ -153,8 +153,8 @@ _type_mapping = {
|
|||||||
_registered_plugins_ = {}
|
_registered_plugins_ = {}
|
||||||
|
|
||||||
def register(proc_name, blurb, help, author, copyright, date, label,
|
def register(proc_name, blurb, help, author, copyright, date, label,
|
||||||
imagetypes, params, results, function, menu=None,
|
imagetypes, params, results, function,
|
||||||
on_query=None, on_run=None):
|
menu=None, domain=None, on_query=None, on_run=None):
|
||||||
'''This is called to register a new plugin.'''
|
'''This is called to register a new plugin.'''
|
||||||
|
|
||||||
# First perform some sanity checks on the data
|
# First perform some sanity checks on the data
|
||||||
@ -213,7 +213,7 @@ def register(proc_name, blurb, help, author, copyright, date, label,
|
|||||||
_registered_plugins_[proc_name] = (blurb, help, author, copyright,
|
_registered_plugins_[proc_name] = (blurb, help, author, copyright,
|
||||||
date, label, imagetypes,
|
date, label, imagetypes,
|
||||||
plugin_type, params, results,
|
plugin_type, params, results,
|
||||||
function, menu, on_query, on_run)
|
function, menu, domain, on_query, on_run)
|
||||||
|
|
||||||
file_params = [(PDB_STRING, "filename", "The name of the file"),
|
file_params = [(PDB_STRING, "filename", "The name of the file"),
|
||||||
(PDB_STRING, "raw-filename", "The name of the file")]
|
(PDB_STRING, "raw-filename", "The name of the file")]
|
||||||
@ -222,7 +222,7 @@ def _query():
|
|||||||
for plugin in _registered_plugins_.keys():
|
for plugin in _registered_plugins_.keys():
|
||||||
(blurb, help, author, copyright, date,
|
(blurb, help, author, copyright, date,
|
||||||
label, imagetypes, plugin_type,
|
label, imagetypes, plugin_type,
|
||||||
params, results, function, menu,
|
params, results, function, menu, domain,
|
||||||
on_query, on_run) = _registered_plugins_[plugin]
|
on_query, on_run) = _registered_plugins_[plugin]
|
||||||
|
|
||||||
def make_params(params):
|
def make_params(params):
|
||||||
@ -247,6 +247,9 @@ def _query():
|
|||||||
params[3:3] = file_params
|
params[3:3] = file_params
|
||||||
|
|
||||||
results = make_params(results)
|
results = make_params(results)
|
||||||
|
|
||||||
|
if domain:
|
||||||
|
gimp.domain_register(domain)
|
||||||
gimp.install_procedure(plugin, blurb, help, author, copyright,
|
gimp.install_procedure(plugin, blurb, help, author, copyright,
|
||||||
date, label, imagetypes, plugin_type,
|
date, label, imagetypes, plugin_type,
|
||||||
params, results)
|
params, results)
|
||||||
@ -259,7 +262,7 @@ def _get_defaults(proc_name):
|
|||||||
import gimpshelf
|
import gimpshelf
|
||||||
(blurb, help, author, copyright, date,
|
(blurb, help, author, copyright, date,
|
||||||
menu, imagetypes, plugin_type,
|
menu, imagetypes, plugin_type,
|
||||||
params, results, function, menu,
|
params, results, function, menu, domain,
|
||||||
on_query, on_run) = _registered_plugins_[proc_name]
|
on_query, on_run) = _registered_plugins_[proc_name]
|
||||||
|
|
||||||
key = "python-fu-save--" + proc_name
|
key = "python-fu-save--" + proc_name
|
||||||
@ -279,7 +282,7 @@ def _set_defaults(proc_name, defaults):
|
|||||||
def _interact(proc_name, start_params):
|
def _interact(proc_name, start_params):
|
||||||
(blurb, help, author, copyright, date,
|
(blurb, help, author, copyright, date,
|
||||||
menu, imagetypes, plugin_type,
|
menu, imagetypes, plugin_type,
|
||||||
params, results, function, menu,
|
params, results, function, menu, domain,
|
||||||
on_query, on_run) = _registered_plugins_[proc_name]
|
on_query, on_run) = _registered_plugins_[proc_name]
|
||||||
|
|
||||||
def run_script(run_params):
|
def run_script(run_params):
|
||||||
@ -612,6 +615,10 @@ def _run(proc_name, params):
|
|||||||
plugin_type = _registered_plugins_[proc_name][7]
|
plugin_type = _registered_plugins_[proc_name][7]
|
||||||
func = _registered_plugins_[proc_name][10]
|
func = _registered_plugins_[proc_name][10]
|
||||||
menu = _registered_plugins_[proc_name][11]
|
menu = _registered_plugins_[proc_name][11]
|
||||||
|
domain = _registered_plugins_[proc_name][12]
|
||||||
|
|
||||||
|
if domain:
|
||||||
|
gettext.install(domain, gimp.locale_directory, unicode=1)
|
||||||
|
|
||||||
if plugin_type == PLUGIN and menu[:7] == '<Image>':
|
if plugin_type == PLUGIN and menu[:7] == '<Image>':
|
||||||
end = 3
|
end = 3
|
||||||
@ -651,3 +658,5 @@ def fail(msg):
|
|||||||
gimp.message(msg)
|
gimp.message(msg)
|
||||||
raise error, msg
|
raise error, msg
|
||||||
|
|
||||||
|
def N_(message):
|
||||||
|
return message
|
||||||
|
@ -724,6 +724,20 @@ pygimp_register_save_handler(PyObject *self, PyObject *args)
|
|||||||
return Py_None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *
|
||||||
|
pygimp_domain_register(PyObject *self, PyObject *args)
|
||||||
|
{
|
||||||
|
char *name, *path = NULL;
|
||||||
|
|
||||||
|
if (!PyArg_ParseTuple(args, "s|s:domain_register", &name, &path))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
gimp_plugin_domain_register(name, path);
|
||||||
|
|
||||||
|
Py_INCREF(Py_None);
|
||||||
|
return Py_None;
|
||||||
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
pygimp_menu_register(PyObject *self, PyObject *args)
|
pygimp_menu_register(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
@ -1498,6 +1512,7 @@ static struct PyMethodDef gimp_methods[] = {
|
|||||||
{"register_magic_load_handler", (PyCFunction)pygimp_register_magic_load_handler, METH_VARARGS},
|
{"register_magic_load_handler", (PyCFunction)pygimp_register_magic_load_handler, METH_VARARGS},
|
||||||
{"register_load_handler", (PyCFunction)pygimp_register_load_handler, METH_VARARGS},
|
{"register_load_handler", (PyCFunction)pygimp_register_load_handler, METH_VARARGS},
|
||||||
{"register_save_handler", (PyCFunction)pygimp_register_save_handler, METH_VARARGS},
|
{"register_save_handler", (PyCFunction)pygimp_register_save_handler, METH_VARARGS},
|
||||||
|
{"domain_register", (PyCFunction)pygimp_domain_register, METH_VARARGS},
|
||||||
{"menu_register", (PyCFunction)pygimp_menu_register, METH_VARARGS},
|
{"menu_register", (PyCFunction)pygimp_menu_register, METH_VARARGS},
|
||||||
{"gamma", (PyCFunction)pygimp_gamma, METH_NOARGS},
|
{"gamma", (PyCFunction)pygimp_gamma, METH_NOARGS},
|
||||||
{"install_cmap", (PyCFunction)pygimp_install_cmap, METH_NOARGS},
|
{"install_cmap", (PyCFunction)pygimp_install_cmap, METH_NOARGS},
|
||||||
@ -1634,9 +1649,9 @@ initgimp(void)
|
|||||||
init_pygimpcolor();
|
init_pygimpcolor();
|
||||||
|
|
||||||
/* initialize i18n support */
|
/* initialize i18n support */
|
||||||
bindtextdomain (GETTEXT_PACKAGE"-python", gimp_locale_directory ());
|
bindtextdomain (GETTEXT_PACKAGE "-python", gimp_locale_directory ());
|
||||||
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
|
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
|
||||||
bind_textdomain_codeset (GETTEXT_PACKAGE"-python", "UTF-8");
|
bind_textdomain_codeset (GETTEXT_PACKAGE "-python", "UTF-8");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* set the default python encoding to utf-8 */
|
/* set the default python encoding to utf-8 */
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
from gimpfu import *
|
from gimpfu import *
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
def console():
|
def console():
|
||||||
import pygtk
|
import pygtk
|
||||||
@ -96,15 +95,15 @@ def console():
|
|||||||
|
|
||||||
register(
|
register(
|
||||||
"python-fu-console",
|
"python-fu-console",
|
||||||
"Python interactive interpreter with gimp extensions",
|
N_("Interactive Gimp-Python interpreter"),
|
||||||
"Type in commands and see results",
|
"Type in commands and see results",
|
||||||
"James Henstridge",
|
"James Henstridge",
|
||||||
"James Henstridge",
|
"James Henstridge",
|
||||||
"1997-1999",
|
"1997-1999",
|
||||||
"_Console",
|
N_("_Console"),
|
||||||
"",
|
"",
|
||||||
[],
|
[],
|
||||||
[],
|
[],
|
||||||
console, menu="<Toolbox>/Xtns/Languages/Python-Fu")
|
console, menu="<Toolbox>/Xtns/Languages/Python-Fu", domain="gimp20-python")
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
@ -33,7 +33,11 @@ import sys, string, traceback
|
|||||||
import pygtk
|
import pygtk
|
||||||
pygtk.require('2.0')
|
pygtk.require('2.0')
|
||||||
import gtk, pango
|
import gtk, pango
|
||||||
from gettext import gettext as _
|
|
||||||
|
from gimp import locale_directory
|
||||||
|
import gettext
|
||||||
|
t = gettext.translation('gimp20-python', locale_directory)
|
||||||
|
_ = t.ugettext
|
||||||
|
|
||||||
stdout = sys.stdout
|
stdout = sys.stdout
|
||||||
|
|
||||||
@ -215,7 +219,7 @@ class Console(gtk.VBox):
|
|||||||
self.buffer.insert_with_tags(iter, *greeting)
|
self.buffer.insert_with_tags(iter, *greeting)
|
||||||
|
|
||||||
self.greetings = ((_('Gimp-Python Console'), 'Title'),
|
self.greetings = ((_('Gimp-Python Console'), 'Title'),
|
||||||
(' -' + _('Interactive Python Development') + '\n',
|
(' - ' + _('Interactive Python Development') + '\n',
|
||||||
'Emphasis'))
|
'Emphasis'))
|
||||||
|
|
||||||
for greeting in self.greetings:
|
for greeting in self.greetings:
|
||||||
|
@ -6,8 +6,8 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: gimp-python HEAD\n"
|
"Project-Id-Version: gimp-python HEAD\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2006-09-15 12:05+0200\n"
|
"POT-Creation-Date: 2006-09-15 13:29+0200\n"
|
||||||
"PO-Revision-Date: 2006-09-15 12:07+0200\n"
|
"PO-Revision-Date: 2006-09-15 13:30+0200\n"
|
||||||
"Last-Translator: Sven Neumann <sven@gimp.org>\n"
|
"Last-Translator: Sven Neumann <sven@gimp.org>\n"
|
||||||
"Language-Team: German <gnome-de@gnome.org>\n"
|
"Language-Team: German <gnome-de@gnome.org>\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
@ -15,20 +15,20 @@ msgstr ""
|
|||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
|
||||||
#: ../plug-ins/pygimp/gimpfu.py:391 ../plug-ins/pygimp/gimpfu.py:403
|
#: ../plug-ins/pygimp/gimpfu.py:394 ../plug-ins/pygimp/gimpfu.py:406
|
||||||
#: ../plug-ins/pygimp/gimpfu.py:409
|
#: ../plug-ins/pygimp/gimpfu.py:412
|
||||||
msgid "No"
|
msgid "No"
|
||||||
msgstr "Nein"
|
msgstr "Nein"
|
||||||
|
|
||||||
#: ../plug-ins/pygimp/gimpfu.py:401 ../plug-ins/pygimp/gimpfu.py:409
|
#: ../plug-ins/pygimp/gimpfu.py:404 ../plug-ins/pygimp/gimpfu.py:412
|
||||||
msgid "Yes"
|
msgid "Yes"
|
||||||
msgstr "Ja"
|
msgstr "Ja"
|
||||||
|
|
||||||
#: ../plug-ins/pygimp/gimpfu.py:447
|
#: ../plug-ins/pygimp/gimpfu.py:450
|
||||||
msgid "Python-Fu File Selection"
|
msgid "Python-Fu File Selection"
|
||||||
msgstr "Python-Fu Dateiauswahl"
|
msgstr "Python-Fu Dateiauswahl"
|
||||||
|
|
||||||
#: ../plug-ins/pygimp/gimpfu.py:458
|
#: ../plug-ins/pygimp/gimpfu.py:461
|
||||||
msgid "Python-Fu Folder Selection"
|
msgid "Python-Fu Folder Selection"
|
||||||
msgstr "Python-Fu Verzeichnisauswahl"
|
msgstr "Python-Fu Verzeichnisauswahl"
|
||||||
|
|
||||||
@ -36,14 +36,22 @@ msgstr "Python-Fu Verzeichnisauswahl"
|
|||||||
msgid "Python Procedure Browser"
|
msgid "Python Procedure Browser"
|
||||||
msgstr "Python Prozedurbrowser"
|
msgstr "Python Prozedurbrowser"
|
||||||
|
|
||||||
#: ../plug-ins/pygimp/plug-ins/gimpcons.py:43
|
#: ../plug-ins/pygimp/plug-ins/gimpcons.py:42
|
||||||
msgid "Python Console"
|
msgid "Python Console"
|
||||||
msgstr "Python Konsole"
|
msgstr "Python Konsole"
|
||||||
|
|
||||||
#: ../plug-ins/pygimp/plug-ins/gimpcons.py:75
|
#: ../plug-ins/pygimp/plug-ins/gimpcons.py:74
|
||||||
msgid "_Browse..."
|
msgid "_Browse..."
|
||||||
msgstr "_Durchsuchen …"
|
msgstr "_Durchsuchen …"
|
||||||
|
|
||||||
|
#: ../plug-ins/pygimp/plug-ins/gimpcons.py:98
|
||||||
|
msgid "Interactive Gimp-Python interpreter"
|
||||||
|
msgstr "Interaktiver Gimp-Python Interpreter"
|
||||||
|
|
||||||
|
#: ../plug-ins/pygimp/plug-ins/gimpcons.py:103
|
||||||
|
msgid "_Console"
|
||||||
|
msgstr "_Konsole"
|
||||||
|
|
||||||
#: ../plug-ins/pygimp/plug-ins/gtkcons.py:217
|
#: ../plug-ins/pygimp/plug-ins/gtkcons.py:217
|
||||||
msgid "Gimp-Python Console"
|
msgid "Gimp-Python Console"
|
||||||
msgstr "Gimp-Python Konsole"
|
msgstr "Gimp-Python Konsole"
|
||||||
|
Reference in New Issue
Block a user