diff options
| author | Patrick Storz <eduard.braun2@gmx.de> | 2019-08-01 20:15:48 +0000 |
|---|---|---|
| committer | Patrick Storz <eduard.braun2@gmx.de> | 2019-08-31 14:50:38 +0000 |
| commit | 62f20457cf5ee85ac42dcd24b564ea68c1b3441d (patch) | |
| tree | e181b3fbe2d408451d6e18b371d753465d13758b /src/extension/prefdialog/parameter.cpp | |
| parent | Parameter: remove unused constructors (diff) | |
| download | inkscape-62f20457cf5ee85ac42dcd24b564ea68c1b3441d.tar.gz inkscape-62f20457cf5ee85ac42dcd24b564ea68c1b3441d.zip | |
Add function to get proper translation within context of Parameter
Diffstat (limited to 'src/extension/prefdialog/parameter.cpp')
| -rw-r--r-- | src/extension/prefdialog/parameter.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/extension/prefdialog/parameter.cpp b/src/extension/prefdialog/parameter.cpp index 2bf83f359..18d2a40ec 100644 --- a/src/extension/prefdialog/parameter.cpp +++ b/src/extension/prefdialog/parameter.cpp @@ -229,11 +229,7 @@ Parameter::Parameter (Inkscape::XML::Node *in_repr, Inkscape::Extension::Extensi } if (gui_text) { if (_translatable != NO) { // translate unless explicitly marked untranslatable - if (_context) { - gui_text = g_dpgettext2(nullptr, context, gui_text); - } else { - gui_text = _(gui_text); - } + gui_text = get_translation(gui_text); } _text = g_strdup(gui_text); } @@ -245,11 +241,7 @@ Parameter::Parameter (Inkscape::XML::Node *in_repr, Inkscape::Extension::Extensi } if (gui_description) { if (_translatable != NO) { // translate unless explicitly marked untranslatable - if (_context) { - gui_description = g_dpgettext2(nullptr, context, gui_description); - } else { - gui_description = _(gui_description); - } + gui_description = get_translation(gui_description); } _description = g_strdup(gui_description); } @@ -331,6 +323,17 @@ Parameter *Parameter::get_param(const gchar */*name*/) return nullptr; } + +const char *Parameter::get_translation(const char* msgid) { + // TODO: translation domain + + if (_context) { + return g_dpgettext2(nullptr, _context, msgid); + } else { + return _(msgid); + } +} + Glib::ustring const extension_pref_root = "/extensions/"; } // namespace Extension |
