SerialTerminal: Tr::tr

Change-Id: Iac630d03a27eb1599485a9b8044d794fc66c7bb2
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alessandro Portale
2023-01-21 23:45:47 +01:00
parent 817553f3e5
commit eada41a393
12 changed files with 47 additions and 61 deletions

View File

@@ -40762,7 +40762,7 @@ Gemning mislykkedes.</translation>
</message> </message>
</context> </context>
<context> <context>
<name>SerialTerminal::Internal::SerialControl</name> <name>::SerialTerminal</name>
<message> <message>
<source>Unable to open port %1.</source> <source>Unable to open port %1.</source>
<translation>Kan ikke åbne porten %1.</translation> <translation>Kan ikke åbne porten %1.</translation>
@@ -40791,9 +40791,6 @@ Gemning mislykkedes.</translation>
<source>Serial port error: %1 (%2)</source> <source>Serial port error: %1 (%2)</source>
<translation>Fejl ved seriel port: %1 (%2)</translation> <translation>Fejl ved seriel port: %1 (%2)</translation>
</message> </message>
</context>
<context>
<name>SerialTerminal::Internal::SerialOutputPane</name>
<message> <message>
<source>Close Tab</source> <source>Close Tab</source>
<translation>Luk faneblad</translation> <translation>Luk faneblad</translation>
@@ -40830,9 +40827,6 @@ Gemning mislykkedes.</translation>
<source>Add New Terminal</source> <source>Add New Terminal</source>
<translation>Tilføj ny terminal</translation> <translation>Tilføj ny terminal</translation>
</message> </message>
</context>
<context>
<name>SerialTerminal::Internal::SerialTerminalOutputPane</name>
<message> <message>
<source>Serial Terminal</source> <source>Serial Terminal</source>
<translation>Seriel terminal</translation> <translation>Seriel terminal</translation>

View File

@@ -41571,7 +41571,7 @@ Was soll %1 tun?</translation>
</message> </message>
</context> </context>
<context> <context>
<name>SerialTerminal::Internal::SerialControl</name> <name>::SerialTerminal</name>
<message> <message>
<source>Unable to open port %1: %2.</source> <source>Unable to open port %1: %2.</source>
<translation>Port %1 konnte nicht geöffnet werden: %2.</translation> <translation>Port %1 konnte nicht geöffnet werden: %2.</translation>
@@ -41600,9 +41600,6 @@ Was soll %1 tun?</translation>
<source>Serial port error: %1 (%2)</source> <source>Serial port error: %1 (%2)</source>
<translation>Fehler des seriellen Ports: %1 (%2)</translation> <translation>Fehler des seriellen Ports: %1 (%2)</translation>
</message> </message>
</context>
<context>
<name>SerialTerminal::Internal::SerialOutputPane</name>
<message> <message>
<source>Close Tab</source> <source>Close Tab</source>
<translation>Reiter schließen</translation> <translation>Reiter schließen</translation>
@@ -41639,9 +41636,6 @@ Was soll %1 tun?</translation>
<source>Add New Terminal</source> <source>Add New Terminal</source>
<translation>Neues Terminal hinzufügen</translation> <translation>Neues Terminal hinzufügen</translation>
</message> </message>
</context>
<context>
<name>SerialTerminal::Internal::SerialTerminalOutputPane</name>
<message> <message>
<source>Serial Terminal</source> <source>Serial Terminal</source>
<translation>Serielles Terminal</translation> <translation>Serielles Terminal</translation>

View File

@@ -33263,7 +33263,7 @@ Row: %4, Column: %5
</message> </message>
</context> </context>
<context> <context>
<name>SerialTerminal::Internal::SerialControl</name> <name>::SerialTerminal</name>
<message> <message>
<source>Unable to open port %1: %2.</source> <source>Unable to open port %1: %2.</source>
<translation>Neuspjelo otvaranje priključka %1: %2.</translation> <translation>Neuspjelo otvaranje priključka %1: %2.</translation>
@@ -33292,9 +33292,6 @@ Row: %4, Column: %5
<source>Serial port error: %1 (%2)</source> <source>Serial port error: %1 (%2)</source>
<translation>Greška u serijskom priključku: %1 (%2)</translation> <translation>Greška u serijskom priključku: %1 (%2)</translation>
</message> </message>
</context>
<context>
<name>SerialTerminal::Internal::SerialOutputPane</name>
<message> <message>
<source>Close Tab</source> <source>Close Tab</source>
<translation>Zatvori karticu</translation> <translation>Zatvori karticu</translation>
@@ -33331,9 +33328,6 @@ Row: %4, Column: %5
<source>Add New Terminal</source> <source>Add New Terminal</source>
<translation>Dodaj novi terminal</translation> <translation>Dodaj novi terminal</translation>
</message> </message>
</context>
<context>
<name>SerialTerminal::Internal::SerialTerminalOutputPane</name>
<message> <message>
<source>Serial Terminal</source> <source>Serial Terminal</source>
<translation>Serijski terminal</translation> <translation>Serijski terminal</translation>

View File

@@ -48466,7 +48466,7 @@ Row: %4, Column: %5
</message> </message>
</context> </context>
<context> <context>
<name>SerialTerminal::Internal::SerialControl</name> <name>::SerialTerminal</name>
<message> <message>
<source>Unable to open port %1: %2.</source> <source>Unable to open port %1: %2.</source>
<translation> %1 : %2</translation> <translation> %1 : %2</translation>
@@ -48475,9 +48475,6 @@ Row: %4, Column: %5
<source>Session resumed.</source> <source>Session resumed.</source>
<translation></translation> <translation></translation>
</message> </message>
</context>
<context>
<name>SerialTerminal::Internal::SerialOutputPane</name>
<message> <message>
<source>Close Tab</source> <source>Close Tab</source>
<translation></translation> <translation></translation>

View File

@@ -42296,7 +42296,7 @@ Row: %4, Column: %5
</message> </message>
</context> </context>
<context> <context>
<name>SerialTerminal::Internal::SerialControl</name> <name>::SerialTerminal</name>
<message> <message>
<source>Unable to open port %1: %2.</source> <source>Unable to open port %1: %2.</source>
<translation>Не удалось открыть порт %1: %2.</translation> <translation>Не удалось открыть порт %1: %2.</translation>
@@ -42325,9 +42325,6 @@ Row: %4, Column: %5
<source>Serial port error: %1 (%2)</source> <source>Serial port error: %1 (%2)</source>
<translation>Ошибка последовательного порта: %1 (%2)</translation> <translation>Ошибка последовательного порта: %1 (%2)</translation>
</message> </message>
</context>
<context>
<name>SerialTerminal::Internal::SerialOutputPane</name>
<message> <message>
<source>Close Tab</source> <source>Close Tab</source>
<translation>Закрыть вкладку</translation> <translation>Закрыть вкладку</translation>
@@ -42364,9 +42361,6 @@ Row: %4, Column: %5
<source>Add New Terminal</source> <source>Add New Terminal</source>
<translation>Добавить новый терминал</translation> <translation>Добавить новый терминал</translation>
</message> </message>
</context>
<context>
<name>SerialTerminal::Internal::SerialTerminalOutputPane</name>
<message> <message>
<source>Serial Terminal</source> <source>Serial Terminal</source>
<translation>Последовательный терминал</translation> <translation>Последовательный терминал</translation>

View File

@@ -40666,7 +40666,7 @@ Row: %4, Column: %5
</message> </message>
</context> </context>
<context> <context>
<name>SerialTerminal::Internal::SerialControl</name> <name>::SerialTerminal</name>
<message> <message>
<source>Unable to open port %1: %2.</source> <source>Unable to open port %1: %2.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@@ -40695,9 +40695,6 @@ Row: %4, Column: %5
<source>Serial port error: %1 (%2)</source> <source>Serial port error: %1 (%2)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context>
<context>
<name>SerialTerminal::Internal::SerialOutputPane</name>
<message> <message>
<source>Close Tab</source> <source>Close Tab</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@@ -40734,9 +40731,6 @@ Row: %4, Column: %5
<source>Add New Terminal</source> <source>Add New Terminal</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context>
<context>
<name>SerialTerminal::Internal::SerialTerminalOutputPane</name>
<message> <message>
<source>Serial Terminal</source> <source>Serial Terminal</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>

View File

@@ -3,6 +3,7 @@
#include "serialcontrol.h" #include "serialcontrol.h"
#include "serialterminalconstants.h" #include "serialterminalconstants.h"
#include "serialterminaltr.h"
#include <utils/outputformatter.h> #include <utils/outputformatter.h>
@@ -42,7 +43,7 @@ bool SerialControl::start()
if (!m_serialPort.open(QIODevice::ReadWrite)) { if (!m_serialPort.open(QIODevice::ReadWrite)) {
if (!m_retrying) { if (!m_retrying) {
appendMessage(tr("Unable to open port %1: %2.") appendMessage(Tr::tr("Unable to open port %1: %2.")
.arg(portName(), m_serialPort.errorString()), .arg(portName(), m_serialPort.errorString()),
Utils::ErrorMessageFormat); Utils::ErrorMessageFormat);
} }
@@ -53,9 +54,9 @@ bool SerialControl::start()
m_serialPort.setRequestToSend(m_initialRtsState); m_serialPort.setRequestToSend(m_initialRtsState);
if (m_retrying) if (m_retrying)
appendMessage(tr("Session resumed.") + QString("\n\n"), Utils::NormalMessageFormat); appendMessage(Tr::tr("Session resumed.") + QString("\n\n"), Utils::NormalMessageFormat);
else else
appendMessage(tr("Starting new session on %1...").arg(portName()) + "\n", Utils::NormalMessageFormat); appendMessage(Tr::tr("Starting new session on %1...").arg(portName()) + "\n", Utils::NormalMessageFormat);
m_retrying = false; m_retrying = false;
@@ -80,7 +81,7 @@ void SerialControl::stop(bool force)
// Print paused or finished message // Print paused or finished message
if (force || (m_running && !m_retrying)) { if (force || (m_running && !m_retrying)) {
appendMessage(QString("\n") appendMessage(QString("\n")
+ tr("Session finished on %1.").arg(portName()) + Tr::tr("Session finished on %1.").arg(portName())
+ QString("\n\n"), + QString("\n\n"),
Utils::NormalMessageFormat); Utils::NormalMessageFormat);
@@ -89,7 +90,7 @@ void SerialControl::stop(bool force)
emit runningChanged(false); emit runningChanged(false);
} else if (m_running && m_retrying) { } else if (m_running && m_retrying) {
appendMessage(QString("\n") appendMessage(QString("\n")
+ tr("Session paused...") + Tr::tr("Session paused...")
+ QString("\n"), + QString("\n"),
Utils::NormalMessageFormat); Utils::NormalMessageFormat);
m_running = false; m_running = false;
@@ -105,7 +106,7 @@ bool SerialControl::isRunning() const
QString SerialControl::displayName() const QString SerialControl::displayName() const
{ {
return portName().isEmpty() ? tr("No Port") : portName(); return portName().isEmpty() ? Tr::tr("No Port") : portName();
} }
bool SerialControl::canReUseOutputPane(const SerialControl *other) const bool SerialControl::canReUseOutputPane(const SerialControl *other) const
@@ -190,7 +191,7 @@ void SerialControl::handleError(QSerialPort::SerialPortError error)
if (!m_retrying && error != QSerialPort::NoError) if (!m_retrying && error != QSerialPort::NoError)
appendMessage(QString("\n") appendMessage(QString("\n")
+ tr("Serial port error: %1 (%2)").arg(m_serialPort.errorString()).arg(error) + Tr::tr("Serial port error: %1 (%2)").arg(m_serialPort.errorString()).arg(error)
+ QString("\n"), + QString("\n"),
Utils::ErrorMessageFormat); Utils::ErrorMessageFormat);

View File

@@ -6,6 +6,7 @@
#include "consolelineedit.h" #include "consolelineedit.h"
#include "serialcontrol.h" #include "serialcontrol.h"
#include "serialterminalconstants.h" #include "serialterminalconstants.h"
#include "serialterminaltr.h"
#include <coreplugin/actionmanager/actioncontainer.h> #include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
@@ -113,9 +114,9 @@ SerialOutputPane::SerialOutputPane(Settings &settings) :
m_tabWidget(new TabWidget), m_tabWidget(new TabWidget),
m_settings(settings), m_settings(settings),
m_devicesModel(new SerialDeviceModel), m_devicesModel(new SerialDeviceModel),
m_closeCurrentTabAction(new QAction(tr("Close Tab"), this)), m_closeCurrentTabAction(new QAction(Tr::tr("Close Tab"), this)),
m_closeAllTabsAction(new QAction(tr("Close All Tabs"), this)), m_closeAllTabsAction(new QAction(Tr::tr("Close All Tabs"), this)),
m_closeOtherTabsAction(new QAction(tr("Close Other Tabs"), this)) m_closeOtherTabsAction(new QAction(Tr::tr("Close Other Tabs"), this))
{ {
createToolButtons(); createToolButtons();
@@ -138,7 +139,7 @@ SerialOutputPane::SerialOutputPane(Settings &settings) :
layout->setContentsMargins(0, 0, 0, 0); layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(2); layout->setSpacing(2);
m_inputLine->setPlaceholderText(tr("Type text and hit Enter to send.")); m_inputLine->setPlaceholderText(Tr::tr("Type text and hit Enter to send."));
inputLayout->addWidget(m_inputLine); inputLayout->addWidget(m_inputLine);
connect(m_inputLine, &QLineEdit::returnPressed, this, &SerialOutputPane::sendInput); connect(m_inputLine, &QLineEdit::returnPressed, this, &SerialOutputPane::sendInput);
@@ -173,7 +174,7 @@ QList<QWidget *> SerialOutputPane::toolBarWidgets() const
QString SerialOutputPane::displayName() const QString SerialOutputPane::displayName() const
{ {
return tr(Constants::OUTPUT_PANE_TITLE); return Tr::tr(Constants::OUTPUT_PANE_TITLE);
} }
int SerialOutputPane::priorityInStatusBar() const int SerialOutputPane::priorityInStatusBar() const
@@ -287,7 +288,7 @@ void SerialOutputPane::createNewOutputWindow(SerialControl *rc)
connect(TextEditorSettings::instance(), &TextEditorSettings::fontSettingsChanged, connect(TextEditorSettings::instance(), &TextEditorSettings::fontSettingsChanged,
this, fontSettingsChanged); this, fontSettingsChanged);
fontSettingsChanged(); fontSettingsChanged();
ow->setWindowTitle(tr("Serial Terminal Window")); ow->setWindowTitle(Tr::tr("Serial Terminal Window"));
// TODO: wordwrap, maxLineCount, zoom/wheelZoom (add to settings) // TODO: wordwrap, maxLineCount, zoom/wheelZoom (add to settings)
auto controlTab = SerialControlTab(rc, ow); auto controlTab = SerialControlTab(rc, ow);
@@ -323,7 +324,7 @@ void SerialOutputPane::createToolButtons()
// Connect button // Connect button
m_connectButton = new QToolButton; m_connectButton = new QToolButton;
m_connectButton->setIcon(Utils::Icons::RUN_SMALL_TOOLBAR.icon()); m_connectButton->setIcon(Utils::Icons::RUN_SMALL_TOOLBAR.icon());
m_connectButton->setToolTip(tr("Connect")); m_connectButton->setToolTip(Tr::tr("Connect"));
m_connectButton->setEnabled(false); m_connectButton->setEnabled(false);
connect(m_connectButton, &QToolButton::clicked, connect(m_connectButton, &QToolButton::clicked,
this, &SerialOutputPane::connectControl); this, &SerialOutputPane::connectControl);
@@ -331,7 +332,7 @@ void SerialOutputPane::createToolButtons()
// Disconnect button // Disconnect button
m_disconnectButton = new QToolButton; m_disconnectButton = new QToolButton;
m_disconnectButton->setIcon(Utils::Icons::STOP_SMALL_TOOLBAR.icon()); m_disconnectButton->setIcon(Utils::Icons::STOP_SMALL_TOOLBAR.icon());
m_disconnectButton->setToolTip(tr("Disconnect")); m_disconnectButton->setToolTip(Tr::tr("Disconnect"));
m_disconnectButton->setEnabled(false); m_disconnectButton->setEnabled(false);
connect(m_disconnectButton, &QToolButton::clicked, connect(m_disconnectButton, &QToolButton::clicked,
@@ -340,7 +341,7 @@ void SerialOutputPane::createToolButtons()
// Reset button // Reset button
m_resetButton = new QToolButton; m_resetButton = new QToolButton;
m_resetButton->setIcon(Utils::Icons::RELOAD_TOOLBAR.icon()); m_resetButton->setIcon(Utils::Icons::RELOAD_TOOLBAR.icon());
m_resetButton->setToolTip(tr("Reset Board")); m_resetButton->setToolTip(Tr::tr("Reset Board"));
m_resetButton->setEnabled(false); m_resetButton->setEnabled(false);
connect(m_resetButton, &QToolButton::clicked, connect(m_resetButton, &QToolButton::clicked,
@@ -349,7 +350,7 @@ void SerialOutputPane::createToolButtons()
// New terminal button // New terminal button
m_newButton = new QToolButton; m_newButton = new QToolButton;
m_newButton->setIcon(Utils::Icons::PLUS_TOOLBAR.icon()); m_newButton->setIcon(Utils::Icons::PLUS_TOOLBAR.icon());
m_newButton->setToolTip(tr("Add New Terminal")); m_newButton->setToolTip(Tr::tr("Add New Terminal"));
m_newButton->setEnabled(true); m_newButton->setEnabled(true);
connect(m_newButton, &QToolButton::clicked, connect(m_newButton, &QToolButton::clicked,

View File

@@ -23,5 +23,6 @@ QtcPlugin {
"serialterminalplugin.h", "serialterminalplugin.h",
"serialterminalsettings.cpp", "serialterminalsettings.cpp",
"serialterminalsettings.h", "serialterminalsettings.h",
"serialterminaltr.h",
] ]
} }

View File

@@ -8,7 +8,7 @@
namespace SerialTerminal { namespace SerialTerminal {
namespace Constants { namespace Constants {
const char OUTPUT_PANE_TITLE[] = QT_TRANSLATE_NOOP("SerialTerminal::Internal::SerialTerminalOutputPane", "Serial Terminal"); const char OUTPUT_PANE_TITLE[] = QT_TRANSLATE_NOOP("::SerialTerminal", "Serial Terminal");
const char LOGGING_CATEGORY[] = "qtc.serialterminal.outputpane"; const char LOGGING_CATEGORY[] = "qtc.serialterminal.outputpane";

View File

@@ -3,6 +3,7 @@
#include "serialterminalsettings.h" #include "serialterminalsettings.h"
#include "serialterminalconstants.h" #include "serialterminalconstants.h"
#include "serialterminaltr.h"
#include <QLoggingCategory> #include <QLoggingCategory>
#include <QSettings> #include <QSettings>
@@ -22,10 +23,10 @@ void readSetting(const QSettings &settings, T &value, const QString &key) {
Settings::Settings() Settings::Settings()
{ {
lineEndings = { lineEndings = {
{QObject::tr("None"), ""}, {Tr::tr("None"), ""},
{QObject::tr("LF"), "\n"}, {Tr::tr("LF"), "\n"},
{QObject::tr("CR"), "\r"}, {Tr::tr("CR"), "\r"},
{QObject::tr("CRLF"), "\r\n"} {Tr::tr("CRLF"), "\r\n"}
}; };
defaultLineEndingIndex = 1; defaultLineEndingIndex = 1;
} }

View File

@@ -0,0 +1,15 @@
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include <QCoreApplication>
namespace SerialTerminal {
struct Tr
{
Q_DECLARE_TR_FUNCTIONS(::SerialTerminal)
};
} // namespace SerialTerminal