Skip to content

Commit 9301143

Browse files
author
Ананьев Александр
committed
Update translation
1 parent 667ecf9 commit 9301143

3 files changed

Lines changed: 34 additions & 4 deletions

File tree

omodsim/menuconnect.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <QEvent>
12
#include <QSerialPortInfo>
23
#include "menuconnect.h"
34

@@ -41,6 +42,32 @@ MenuConnect::MenuConnect(MenuType type, ModbusMultiServer& server, QWidget *pare
4142
});
4243
}
4344

45+
///
46+
/// \brief MenuConnect::changeEvent
47+
/// \param event
48+
///
49+
void MenuConnect::changeEvent(QEvent* event)
50+
{
51+
if (event->type() == QEvent::LanguageChange)
52+
{
53+
for(auto&& a : actions())
54+
{
55+
const auto data = a->data().value<QPair<ConnectionType, QString>>();
56+
switch(data.first)
57+
{
58+
case ConnectionType::Tcp:
59+
a->setText(tr("Modbus/TCP Srv"));
60+
break;
61+
case ConnectionType::Serial:
62+
a->setText(QString(tr("Port %1")).arg(data.second));
63+
break;
64+
}
65+
}
66+
}
67+
68+
QMenu::changeEvent(event);
69+
}
70+
4471
///
4572
/// \brief MenuConnect::canConnect
4673
/// \param cd

omodsim/menuconnect.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ class MenuConnect : public QMenu
2424
void connectAction(ConnectionDetails& cd);
2525
void disconnectAction(ConnectionType type, const QString& port);
2626

27+
protected:
28+
void changeEvent(QEvent* event) override;
29+
2730
private:
2831
void addAction(const QString& text, ConnectionType type, const QString& port);
2932

omodsim/translations/omodsim_ru.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,10 +1096,10 @@ Length: %2</source>
10961096
<translation></translation>
10971097
</message>
10981098
<message>
1099-
<location filename="../mainwindow.cpp" line="252"/>
1100-
<location filename="../mainwindow.cpp" line="291"/>
1101-
<location filename="../mainwindow.cpp" line="304"/>
1102-
<location filename="../mainwindow.cpp" line="315"/>
1099+
<location filename="../mainwindow.cpp" line="246"/>
1100+
<location filename="../mainwindow.cpp" line="285"/>
1101+
<location filename="../mainwindow.cpp" line="298"/>
1102+
<location filename="../mainwindow.cpp" line="309"/>
11031103
<source>All files (*)</source>
11041104
<translation>Все файлы (*)</translation>
11051105
</message>

0 commit comments

Comments
 (0)