summaryrefslogtreecommitdiffstats
path: root/src/extension/implementation
diff options
context:
space:
mode:
authorPatrick Storz <eduard.braun2@gmx.de>2019-10-17 00:16:32 +0000
committerPatrick Storz <eduard.braun2@gmx.de>2019-10-19 12:33:34 +0000
commit76ce73061550ff42e97c1fec9836c35cc0e24d64 (patch)
tree9ea6f017e13bc4f5cc63eb17f8a23e1e58ccee3a /src/extension/implementation
parentAdd export/import PDF blend modes and add isolation modifier (diff)
downloadinkscape-76ce73061550ff42e97c1fec9836c35cc0e24d64.tar.gz
inkscape-76ce73061550ff42e97c1fec9836c35cc0e24d64.zip
Extensions: Implement translationdomain functionality
Inkscape will read the "translationdomain" attribute from the <inkscape-extension> root element in the .inx file. It will then attempt to lookup a message catalog that matches this domain, register it with gettext, and use it for translations. Message catalogs may be located in either - the .inx file's location - the root of the "extensions" directory containing the .inx - the system location Inkscape's own catalog is loaded from To make this functionality available to script extensions, Inkscape will set the environment variables INKEX_GETTEXT_DOMAIN and INKEX_GETTEXT_DIRECTORY so extension scripts can then use something like bindtextdomain(INKEX_GETTEXT_DOMAIN, INKEX_GETTEXT_DIRECTORY) textdomain(INKEX_GETTEXT_DOMAIN) to enable the feature. See also https://gitlab.com/inkscape/inkscape/issues/333 https://gitlab.com/inkscape/extensions/issues/117
Diffstat (limited to 'src/extension/implementation')
-rw-r--r--src/extension/implementation/script.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp
index c38cc516f..12e4e809b 100644
--- a/src/extension/implementation/script.cpp
+++ b/src/extension/implementation/script.cpp
@@ -124,7 +124,7 @@ std::string Script::resolveInterpreterExecutable(const Glib::ustring &interpName
// on Windows, so no extra code is necessary.
if (!Glib::path_is_absolute(interpreter_path)) {
std::string found_path = Glib::find_program_in_path(interpreter_path);
- if (found_path.empty()) {
+ if (found_path.empty()) {
g_critical("Script::resolveInterpreterExecutable(): failed to locate script interpreter '%s'; "
"'%s' not found on PATH", interpNameArg.c_str(), interpreter_path.c_str());
}
@@ -247,7 +247,7 @@ bool Script::check(Inkscape::Extension::Extension *module)
while (child_repr != nullptr) {
if (!strcmp(child_repr->name(), INKSCAPE_EXTENSION_NS "script")) {
script_count++;
-
+
// check if all helper_extensions attached to this script were registered
child_repr = child_repr->firstChild();
while (child_repr != nullptr) {
@@ -359,7 +359,7 @@ Gtk::Widget *Script::prefs_output(Inkscape::Extension::Output *module)
the header of ink_ext_.
The extension is then executed using the 'execute' function
- with the filename assigned and then the temporary filename.
+ with the filename assigned and then the temporary filename.
After execution the SVG should be in the temporary file.
Finally, the temporary file is opened using the SVG input module and
@@ -372,6 +372,7 @@ SPDocument *Script::open(Inkscape::Extension::Input *module,
{
std::list<std::string> params;
module->paramListString(params);
+ module->set_environment();
std::string tempfilename_out;
int tempfd_out = 0;
@@ -447,6 +448,7 @@ void Script::save(Inkscape::Extension::Output *module,
{
std::list<std::string> params;
module->paramListString(params);
+ module->set_environment();
std::string tempfilename_in;
int tempfd_in = 0;
@@ -545,6 +547,7 @@ void Script::effect(Inkscape::Extension::Effect *module,
std::list<std::string> params;
module->paramListString(params);
+ module->set_environment();
parent_window = module->get_execution_env()->get_working_dialog();
@@ -616,7 +619,7 @@ void Script::effect(Inkscape::Extension::Effect *module,
// Getting the named view from the document generated by the extension
SPNamedView *nv = sp_document_namedview(mydoc, nullptr);
-
+
//Check if it has a default layer set up
SPObject *layer = nullptr;
if ( nv != nullptr)
@@ -631,7 +634,7 @@ void Script::effect(Inkscape::Extension::Effect *module,
}
desktop->showGrids(nv->grids_visible);
}
-
+
sp_namedview_update_layers_from_document(desktop);
//If that layer exists,
if (layer) {