Skip to content

Commit

Permalink
gui: improve connection type translations and translator comments
Browse files Browse the repository at this point in the history
Co-authored-by: Jarol Rodriguez <jarolrod@tutanota.com>
  • Loading branch information
jonatack and jarolrod committed May 5, 2021
1 parent be37e23 commit f4bde8c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -666,10 +666,12 @@ QString ConnectionTypeToQString(ConnectionType conn_type, bool prepend_direction
{
QString prefix;
if (prepend_direction) {
//: Connection direction. Also used in CONNECTION_TYPE_DOC and PeerTableModel::data().
prefix = (conn_type == ConnectionType::INBOUND) ? QObject::tr("Inbound") : QObject::tr("Outbound") + " ";
}
switch (conn_type) {
case ConnectionType::INBOUND: return prefix;
//: The connection types (Full Relay, Block Relay, Manual, Feeler, Address Fetch) are also used in CONNECTION_TYPE_DOC.
case ConnectionType::OUTBOUND_FULL_RELAY: return prefix + QObject::tr("Full Relay");
case ConnectionType::BLOCK_RELAY: return prefix + QObject::tr("Block Relay");
case ConnectionType::MANUAL: return prefix + QObject::tr("Manual");
Expand Down
18 changes: 12 additions & 6 deletions src/qt/rpcconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <QDateTime>
#include <QFont>
#include <QKeyEvent>
#include <QLatin1String>
#include <QMenu>
#include <QMessageBox>
#include <QScreen>
Expand All @@ -53,6 +54,9 @@ const int INITIAL_TRAFFIC_GRAPH_MINS = 30;
const QSize FONT_RANGE(4, 40);
const char fontSizeSettingsKey[] = "consoleFontSize";

const QLatin1String COLON_SPACE{": "};
const QLatin1String SPACE{" "};

const struct {
const char *url;
const char *source;
Expand Down Expand Up @@ -463,15 +467,17 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty

constexpr QChar nonbreaking_hyphen(8209);
const std::vector<QString> CONNECTION_TYPE_DOC{
tr("Inbound: initiated by peer"),
tr("Outbound Full Relay: default"),
tr("Outbound Block Relay: does not relay transactions or addresses"),
tr("Outbound Manual: added using RPC %1 or %2/%3 configuration options")
//: The connection direction (Inbound/Outbound) is also used in ConnectionTypeToQString() and PeerTableModel::data().
//: The connection types (Full Relay, Block Relay, Manual, Feeler, Address Fetch) are also used in ConnectionTypeToQString().
tr("Inbound") + COLON_SPACE + tr("initiated by peer"),
tr("Outbound") + SPACE + tr("Full Relay") + COLON_SPACE + tr("default"),
tr("Outbound") + SPACE + tr("Block Relay") + COLON_SPACE + tr("does not relay transactions or addresses"),
tr("Outbound") + SPACE + tr("Manual") + COLON_SPACE + tr("added using RPC %1 or %2/%3 configuration options")
.arg("addnode")
.arg(QString(nonbreaking_hyphen) + "addnode")
.arg(QString(nonbreaking_hyphen) + "connect"),
tr("Outbound Feeler: short-lived, for testing addresses"),
tr("Outbound Address Fetch: short-lived, for soliciting addresses")};
tr("Outbound") + SPACE + tr("Feeler") + COLON_SPACE + tr("short-lived, for testing addresses"),
tr("Outbound") + SPACE + tr("Address Fetch") + COLON_SPACE + tr("short-lived, for soliciting addresses")};
const QString list{"<ul><li>" + Join(CONNECTION_TYPE_DOC, QString("</li><li>")) + "</li></ul>"};
ui->peerConnectionTypeLabel->setToolTip(ui->peerConnectionTypeLabel->toolTip().arg(list));
const QString hb_list{"<ul><li>\""
Expand Down

0 comments on commit f4bde8c

Please sign in to comment.