Skip to content

Commit 842f4e8

Browse files
committed
gui: improve connection type translations and translator comments
1 parent 678b572 commit 842f4e8

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

src/qt/guiutil.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,10 +666,12 @@ QString ConnectionTypeToQString(ConnectionType conn_type, bool prepend_direction
666666
{
667667
QString prefix;
668668
if (prepend_direction) {
669+
//: Connection direction. Also used in CONNECTION_TYPE_DOC and PeerTableModel::data().
669670
prefix = (conn_type == ConnectionType::INBOUND) ? QObject::tr("Inbound") : QObject::tr("Outbound") + " ";
670671
}
671672
switch (conn_type) {
672673
case ConnectionType::INBOUND: return prefix;
674+
//: The connection types (Full Relay, Block Relay, Manual, Feeler, Address Fetch) are also used in CONNECTION_TYPE_DOC.
673675
case ConnectionType::OUTBOUND_FULL_RELAY: return prefix + QObject::tr("Full Relay");
674676
case ConnectionType::BLOCK_RELAY: return prefix + QObject::tr("Block Relay");
675677
case ConnectionType::MANUAL: return prefix + QObject::tr("Manual");

src/qt/rpcconsole.cpp

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@
3737
#include <QDateTime>
3838
#include <QFont>
3939
#include <QKeyEvent>
40+
#include <QLatin1String>
4041
#include <QMenu>
4142
#include <QMessageBox>
4243
#include <QScreen>
4344
#include <QScrollBar>
4445
#include <QSettings>
4546
#include <QString>
47+
#include <QStringBuilder>
4648
#include <QStringList>
4749
#include <QTime>
4850
#include <QTimer>
@@ -53,6 +55,9 @@ const int INITIAL_TRAFFIC_GRAPH_MINS = 30;
5355
const QSize FONT_RANGE(4, 40);
5456
const char fontSizeSettingsKey[] = "consoleFontSize";
5557

58+
const QLatin1String COLON_SPACE{": "};
59+
const QLatin1String SPACE{" "};
60+
5661
const struct {
5762
const char *url;
5863
const char *source;
@@ -463,16 +468,18 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
463468

464469
constexpr QChar nonbreaking_hyphen(8209);
465470
const std::vector<QString> CONNECTION_TYPE_DOC{
466-
tr("Inbound: initiated by peer"),
467-
tr("Outbound Full Relay: default"),
468-
tr("Outbound Block Relay: does not relay transactions or addresses"),
469-
tr("Outbound Manual: added using RPC %1 or %2/%3 configuration options")
471+
//: The connection direction (Inbound/Outbound) is also used in ConnectionTypeToQString() and PeerTableModel::data().
472+
//: The connection types (Full Relay, Block Relay, Manual, Feeler, Address Fetch) are also used in ConnectionTypeToQString().
473+
tr("Inbound") % COLON_SPACE % tr("initiated by peer"),
474+
tr("Outbound") % SPACE % tr("Full Relay") % COLON_SPACE % tr("default"),
475+
tr("Outbound") % SPACE % tr("Block Relay") % COLON_SPACE % tr("does not relay transactions or addresses"),
476+
tr("Outbound") % SPACE % tr("Manual") % COLON_SPACE % tr("added using RPC %1 or %2/%3 configuration options")
470477
.arg("addnode")
471-
.arg(QString(nonbreaking_hyphen) + "addnode")
472-
.arg(QString(nonbreaking_hyphen) + "connect"),
473-
tr("Outbound Feeler: short-lived, for testing addresses"),
474-
tr("Outbound Address Fetch: short-lived, for soliciting addresses")};
475-
const QString list{"<ul><li>" + Join(CONNECTION_TYPE_DOC, QString("</li><li>")) + "</li></ul>"};
478+
.arg(QString(nonbreaking_hyphen) % "addnode")
479+
.arg(QString(nonbreaking_hyphen) % "connect"),
480+
tr("Outbound") % SPACE % tr("Feeler") % COLON_SPACE % tr("short-lived, for testing addresses"),
481+
tr("Outbound") % SPACE % tr("Address Fetch") % COLON_SPACE % tr("short-lived, for soliciting addresses")};
482+
const QString list{"<ul><li>" % Join(CONNECTION_TYPE_DOC, QString("</li><li>")) % "</li></ul>"};
476483
ui->peerConnectionTypeLabel->setToolTip(ui->peerConnectionTypeLabel->toolTip().arg(list));
477484
const QString hb_list{"<ul><li>\""
478485
+ ts.to + "\"" + tr("we selected the peer for high bandwidth relay") + "</li><li>\""

0 commit comments

Comments
 (0)