diff options
author | Tobias Markmann <tm@ayena.de> | 2016-04-26 07:51:29 (GMT) |
---|---|---|
committer | Kevin Smith <kevin.smith@isode.com> | 2016-04-26 08:33:30 (GMT) |
commit | 15eb4fa29ab6516175ddc2c677b42aebfd0405e1 (patch) | |
tree | be7bd4bd5774a9c0b02fa51d0b02b7811fc73080 | |
parent | 857791adda753a0f94da8317bbc019378b1f09bd (diff) | |
download | swift-15eb4fa29ab6516175ddc2c677b42aebfd0405e1.zip swift-15eb4fa29ab6516175ddc2c677b42aebfd0405e1.tar.bz2 |
Make remaining UI strings in QtHighlightEditor translatable
Test-Information:
Builds on OS X 10.11.4 with Qt 5.4.2 and the short description
still shows the strings in the UI.
Checked that update_translations=1 shows the newly translatable
strings.
Change-Id: I7acc1058fbb07a5f1ed630c5cc95493f2bc79770
-rw-r--r-- | Swift/QtUI/QtHighlightEditor.cpp | 26 | ||||
-rw-r--r-- | Swift/QtUI/QtHighlightEditor.h | 2 |
2 files changed, 15 insertions, 13 deletions
diff --git a/Swift/QtUI/QtHighlightEditor.cpp b/Swift/QtUI/QtHighlightEditor.cpp index fdbff9e..dd95941 100644 --- a/Swift/QtUI/QtHighlightEditor.cpp +++ b/Swift/QtUI/QtHighlightEditor.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -90,30 +90,30 @@ QtHighlightEditor::~QtHighlightEditor() { } -std::string formatShortDescription(const HighlightRule &rule) +QString QtHighlightEditor::formatShortDescription(const HighlightRule &rule) { - const std::string chatOrRoom = (rule.getMatchChat() ? "chat" : "room"); + const QString chatOrRoom = (rule.getMatchChat() ? tr("chat") : tr("room")); std::vector<std::string> senders = rule.getSenders(); std::vector<std::string> keywords = rule.getKeywords(); if (senders.empty() && keywords.empty() && !rule.getNickIsKeyword()) { - return std::string("All ") + chatOrRoom + " messages."; + return tr("All %1 messages.").arg(chatOrRoom); } if (rule.getNickIsKeyword()) { - return std::string("All ") + chatOrRoom + " messages that mention my name."; + return tr("All %1 messages that mention my name.").arg(chatOrRoom); } if (!senders.empty()) { - return std::string("All ") + chatOrRoom + " messages from " + senders[0] + "."; + return tr("All %1 messages from %2.").arg(chatOrRoom, P2QSTRING(senders[0])); } if (!keywords.empty()) { - return std::string("All ") + chatOrRoom + " messages mentioning the keyword '" + keywords[0] + "'."; + return tr("All %1 messages mentioning the keyword '%2'.").arg(chatOrRoom, P2QSTRING(keywords[0])); } - return "Unknown Rule"; + return tr("Unknown Rule"); } void QtHighlightEditor::show() @@ -177,7 +177,7 @@ void QtHighlightEditor::onNewButtonClicked() newRule.setMatchMUC(true); highlightManager_->insertRule(row, newRule); QListWidgetItem *item = new QListWidgetItem(); - item->setText(P2QSTRING(formatShortDescription(newRule))); + item->setText(formatShortDescription(newRule)); QFont font; font.setItalic(true); item->setFont(font); @@ -246,7 +246,7 @@ void QtHighlightEditor::onCurrentRowChanged(int currentRow) QFont font; font.setItalic(true); ui_.listWidget->currentItem()->setFont(font); - ui_.listWidget->currentItem()->setText(P2QSTRING(formatShortDescription(rule))); + ui_.listWidget->currentItem()->setText(formatShortDescription(rule)); } } @@ -323,7 +323,7 @@ void QtHighlightEditor::widgetClick() HighlightRule rule = ruleFromDialog(); if (ui_.listWidget->currentItem()) { - ui_.listWidget->currentItem()->setText(P2QSTRING(formatShortDescription(rule))); + ui_.listWidget->currentItem()->setText(formatShortDescription(rule)); } } @@ -358,7 +358,7 @@ void QtHighlightEditor::handleContactSuggestionRequested(const QString& text) void QtHighlightEditor::selectSoundFile() { - QString path = QFileDialog::getOpenFileName(this, tr("Select sound file..."), QString(), "Sounds (*.wav)"); + QString path = QFileDialog::getOpenFileName(this, tr("Select sound file..."), QString(), tr("Sounds (*.wav)")); ui_.soundFile->setText(path); } @@ -385,7 +385,7 @@ void QtHighlightEditor::populateList() for (size_t i = 0; i < rules->getSize(); ++i) { const HighlightRule& rule = rules->getRule(i); QListWidgetItem *item = new QListWidgetItem(); - item->setText(P2QSTRING(formatShortDescription(rule))); + item->setText(formatShortDescription(rule)); ui_.listWidget->addItem(item); } } diff --git a/Swift/QtUI/QtHighlightEditor.h b/Swift/QtUI/QtHighlightEditor.h index 845b11b..dbcef4b 100644 --- a/Swift/QtUI/QtHighlightEditor.h +++ b/Swift/QtUI/QtHighlightEditor.h @@ -55,6 +55,7 @@ namespace Swift { void onResetToDefaultRulesClicked(); private: + QString formatShortDescription(const HighlightRule &rule); void handleOnUserSelected(const Contact::ref& contact); void populateList(); void selectRow(int row); @@ -64,6 +65,7 @@ namespace Swift { void updateResetToDefaultRulesVisibility(); void moveRowFromTo(int fromRow, int toRow); + private: Ui::QtHighlightEditor ui_; QtSettingsProvider* settings_; HighlightManager* highlightManager_; |