From 6f15692726681034391d42c58aa870e9dbba642f Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 5 Jun 2016 19:35:39 +0200 Subject: Extensions: Fixes and improvements for "gui-text" parameter attribute - "gui-text" was always translated (as opposed to only "_gui-text") - This made it impossible to have parameters without label (since the empty string returns the whole .po file header when translated), which caused an issue in restack extension - Added possibility to specify "msgctxt" for "gui-text" (bzr r14955) --- src/extension/param/parameter.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/extension/param/parameter.cpp') diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index 10029893f..27d9bdf9b 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -20,6 +20,7 @@ #endif #include +#include #include "ui/widget/color-notebook.h" #include @@ -56,6 +57,16 @@ Parameter *Parameter::make(Inkscape::XML::Node *in_repr, Inkscape::Extension::Ex const char *guitext = in_repr->attribute("gui-text"); if (guitext == NULL) { guitext = in_repr->attribute("_gui-text"); + if (guitext == NULL) { + // guitext = ""; // propably better to require devs to explicitly set an empty gui-text if this is what they want + } else { + const char *context = in_repr->attribute("msgctxt"); + if (context != NULL) { + guitext = g_dpgettext2(NULL, context, guitext); + } else { + guitext = _(guitext); + } + } } const char *gui_tip = in_repr->attribute("gui-tip"); if (gui_tip == NULL) { -- cgit v1.2.3 From 64b7a2d79f1e160e9e4ee723fd89f8aadd177924 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sat, 11 Jun 2016 19:20:13 +0200 Subject: Clean up includes after r14955 Fixed bugs: - https://launchpad.net/bugs/1589300 (bzr r14978) --- src/extension/param/parameter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/extension/param/parameter.cpp') diff --git a/src/extension/param/parameter.cpp b/src/extension/param/parameter.cpp index 27d9bdf9b..e4a614667 100644 --- a/src/extension/param/parameter.cpp +++ b/src/extension/param/parameter.cpp @@ -20,7 +20,6 @@ #endif #include -#include #include "ui/widget/color-notebook.h" #include @@ -41,6 +40,8 @@ #include "radiobutton.h" #include "string.h" +#include + namespace Inkscape { namespace Extension { -- cgit v1.2.3