From fb4bbb1cd589d73d3bb0b46d481369b7d1e87fdf Mon Sep 17 00:00:00 2001 From: Patrick Storz Date: Fri, 20 Sep 2019 23:39:16 +0200 Subject: Symbol dialog: Fix translation of symbol and symbol set names Fixes https://gitlab.com/inkscape/inkscape/issues/429 --- po/de.po | 12 +++++------- src/ui/dialog/symbols.cpp | 43 +++++++++++++++++++++++++------------------ src/ui/dialog/symbols.h | 3 +++ 3 files changed, 33 insertions(+), 25 deletions(-) diff --git a/po/de.po b/po/de.po index 815f676c4..47d03714c 100644 --- a/po/de.po +++ b/po/de.po @@ -24021,7 +24021,6 @@ msgid "All paint servers" msgstr "Alles inaktiv" #: ../src/ui/dialog/paint-servers.h:59 ../src/ui/dialog/symbols.cpp:75 -#, fuzzy msgid "Current document" msgstr "Aktuelles Dokument" @@ -24693,13 +24692,12 @@ msgid "Wrap" msgstr "Umbrechen" #: ../src/ui/dialog/symbols.cpp:76 -#, fuzzy msgid "All symbol sets" -msgstr "Symbolsatz:" +msgstr "Alle Symbolsätze" #: ../src/ui/dialog/symbols.cpp:128 -msgid "Symbol set: " -msgstr "Symbolsatz:" +msgid "Symbol set" +msgstr "Symbolsatz" #: ../src/ui/dialog/symbols.cpp:157 msgid "Return to start search." @@ -24789,8 +24787,8 @@ msgid "notitle_" msgstr "" #: ../src/ui/dialog/symbols.cpp:1224 -msgid "Symbol without title " -msgstr "" +msgid "Symbol without title" +msgstr "Symbol ohne Namen" #: ../src/ui/dialog/template-widget.cpp:32 msgid "More info" diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 2ecf612d2..b03bd5d26 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -72,8 +72,7 @@ namespace Inkscape { namespace UI { namespace Dialog { -const Glib::ustring CURRENTDOC = _("Current document"); -const Glib::ustring ALLDOCS = _("All symbol sets"); + // See: http://developer.gnome.org/gtkmm/stable/classGtk_1_1TreeModelColumnRecord.html class SymbolColumns : public Gtk::TreeModel::ColumnRecord { @@ -111,7 +110,9 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : desk_track(), current_document(nullptr), preview_document(nullptr), - instanceConns() + instanceConns(), + CURRENTDOC(_("Current document")), + ALLDOCS(_("All symbol sets")) { /******************** Table *************************/ @@ -125,7 +126,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : guint row = 0; /******************** Symbol Sets *************************/ - Gtk::Label* label_set = new Gtk::Label(_("Symbol set: ")); + Gtk::Label* label_set = new Gtk::Label(Glib::ustring(_("Symbol set")) + ": "); table->attach(*Gtk::manage(label_set),0,row,1,1); symbol_set = new Gtk::ComboBoxText(); // Fill in later symbol_set->append(CURRENTDOC); @@ -814,6 +815,7 @@ void SymbolsDialog::getSymbolsTitle() { while (std::getline(infile, line)) { std::string title_res = std::regex_replace (line, matchtitle,"$1",std::regex_constants::format_no_copy); if (!title_res.empty()) { + title_res = g_dpgettext2(nullptr, "Symbol", title_res.c_str()); symbol_sets[ellipsize(Glib::ustring(title_res), 33)]= nullptr; ++number_docs; break; @@ -884,6 +886,7 @@ SymbolsDialog::getSymbolsSet(Glib::ustring title) while (std::getline(infile, line)) { std::string title_res = std::regex_replace (line, matchtitle,"$1",std::regex_constants::format_no_copy); if (!title_res.empty()) { + title_res = g_dpgettext2(nullptr, "Symbol", title_res.c_str()); new_title = ellipsize(Glib::ustring(title_res), 33); } std::size_t pos = filename.find_last_of("/\\"); @@ -1208,31 +1211,35 @@ void SymbolsDialog::addSymbols() { } } -void SymbolsDialog::addSymbol( SPObject* symbol, Glib::ustring doc_title) { - - SymbolColumns* columns = getColumns(); - - gchar const *id = symbol->getRepr()->attribute("id"); - gchar * title = symbol->title(); // From title element +void SymbolsDialog::addSymbol( SPObject* symbol, Glib::ustring doc_title) +{ + gchar const *id = symbol->getRepr()->attribute("id"); + if (doc_title.empty()) { doc_title = CURRENTDOC; + } else { + doc_title = g_dpgettext2(nullptr, "Symbol", doc_title.c_str()); } - Glib::ustring symbol_title = ""; - if(title) { - symbol_title = Glib::ustring(title) + Glib::ustring(" (") + doc_title + Glib::ustring(")"); + + Glib::ustring symbol_title; + gchar *title = symbol->title(); // From title element + if (title) { + symbol_title = Glib::ustring::compose("%1 (%2)", g_dpgettext2(nullptr, "Symbol", title), doc_title.c_str()); } else { - symbol_title = Glib::ustring(_("Symbol without title ")) + Glib::ustring(id) + Glib::ustring(" (") + doc_title + Glib::ustring(")"); + symbol_title = Glib::ustring::compose("%1 %2 (%3)", _("Symbol without title"), Glib::ustring(id), doc_title); } + g_free(title); + Glib::RefPtr pixbuf = drawSymbol( symbol ); if( pixbuf ) { Gtk::ListStore::iterator row = store->append(); + SymbolColumns* columns = getColumns(); (*row)[columns->symbol_id] = Glib::ustring( id ); - (*row)[columns->symbol_title] = Glib::Markup::escape_text(Glib::ustring( g_dpgettext2(nullptr, "Symbol", symbol_title.c_str()) )); - (*row)[columns->symbol_doc_title] = Glib::Markup::escape_text(Glib::ustring( g_dpgettext2(nullptr, "SymbolDoc", doc_title.c_str()) )); + (*row)[columns->symbol_title] = Glib::Markup::escape_text(symbol_title); + (*row)[columns->symbol_doc_title] = Glib::Markup::escape_text(doc_title); (*row)[columns->symbol_image] = pixbuf; + delete columns; } - g_free(title); - delete columns; } /* diff --git a/src/ui/dialog/symbols.h b/src/ui/dialog/symbols.h index 6855a5b7a..382d31017 100644 --- a/src/ui/dialog/symbols.h +++ b/src/ui/dialog/symbols.h @@ -70,6 +70,9 @@ private: static SymbolColumns *getColumns(); + Glib::ustring CURRENTDOC; + Glib::ustring ALLDOCS; + void packless(); void packmore(); void zoomin(); -- cgit v1.2.3