From ea05ba3338bec1517826614f27935a36c3b0f0f8 Mon Sep 17 00:00:00 2001 From: Patrick Storz Date: Sun, 4 Aug 2019 01:34:27 +0200 Subject: Implement "translationdomain" attribute for extensions Will allow extensions to ship their own message catalog used for translation of the extension#s strings. Needs to be set on the root element of the .inx Currently supported values: - unset: use default textdomain (which happens to be 'inkscape') - 'inkscape': use Inkscape's message catalog - 'none': disable translation for the extension's strings --- src/extension/input.cpp | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'src/extension/input.cpp') diff --git a/src/extension/input.cpp b/src/extension/input.cpp index dd9485202..d28d8113a 100644 --- a/src/extension/input.cpp +++ b/src/extension/input.cpp @@ -182,23 +182,35 @@ Input::get_extension() \return The name of the filetype supported \brief Get the name of the filetype supported */ -gchar * -Input::get_filetypename() +const char * +Input::get_filetypename(bool translated) { - if (filetypename != nullptr) - return filetypename; + const char *name; + + if (filetypename) + name = filetypename; else - return get_name(); + name = get_name(); + + if (name && translated) { + return get_translation(name); + } else { + return name; + } } /** \return Tooltip giving more information on the filetype \brief Get the tooltip for more information on the filetype */ -gchar * -Input::get_filetypetooltip() +const char * +Input::get_filetypetooltip(bool translated) { - return filetypetooltip; + if (filetypetooltip && translated) { + return get_translation(filetypetooltip); + } else { + return filetypetooltip; + } } /** @@ -224,7 +236,8 @@ Input::prefs (const gchar *uri) return true; } - PrefDialog * dialog = new PrefDialog(this->get_name(), controls); + Glib::ustring name = get_translation(this->get_name()); + PrefDialog *dialog = new PrefDialog(name, controls); int response = dialog->run(); dialog->hide(); -- cgit v1.2.3