diff --git a/QtScrcpy/QtScrcpy.pro b/QtScrcpy/QtScrcpy.pro
index 5b39a93..9e31367 100644
--- a/QtScrcpy/QtScrcpy.pro
+++ b/QtScrcpy/QtScrcpy.pro
@@ -148,5 +148,3 @@ linux {
RESOURCES += \
res.qrc
-DISTFILES +=
-
diff --git a/QtScrcpy/dialog.ui b/QtScrcpy/dialog.ui
index 8675958..0e7f8a8 100644
--- a/QtScrcpy/dialog.ui
+++ b/QtScrcpy/dialog.ui
@@ -23,7 +23,7 @@
- QtScrcpy
+ QtScrcpy
-
@@ -57,7 +57,7 @@
- :
+ :
@@ -137,6 +137,9 @@
-
+
+
+
@@ -150,7 +153,11 @@
-
-
+
+
+
+
+
-
diff --git a/QtScrcpy/i18n/QtScrcpy_en.qm b/QtScrcpy/i18n/QtScrcpy_en.qm
new file mode 100644
index 0000000..ed78088
Binary files /dev/null and b/QtScrcpy/i18n/QtScrcpy_en.qm differ
diff --git a/QtScrcpy/i18n/QtScrcpy_en.ts b/QtScrcpy/i18n/QtScrcpy_en.ts
new file mode 100644
index 0000000..df70b71
--- /dev/null
+++ b/QtScrcpy/i18n/QtScrcpy_en.ts
@@ -0,0 +1,128 @@
+
+
+
+
+ Dialog
+
+
+ Wireless
+ Wireless
+
+
+
+ wireless connect
+ wireless connect
+
+
+
+ wireless disconnect
+ wireless disconnect
+
+
+
+ USB line
+ USB line
+
+
+
+ stop server
+ stop server
+
+
+
+ start server
+ start server
+
+
+
+ device serial:
+ device serial:
+
+
+
+ bit rate:
+ bit rate:
+
+
+
+ video size:
+ video size:
+
+
+
+ start adbd
+ start adbd
+
+
+
+ get device ip
+ get device ip
+
+
+
+ update device
+ update device
+
+
+
+ ToolForm
+
+
+ Tool
+ Tool
+
+
+
+ full screen
+ full screen
+
+
+
+ turn off
+ turn off
+
+
+
+ turn on
+ turn on
+
+
+
+ volume up
+ volume up
+
+
+
+ volume down
+ volume down
+
+
+
+ app switch
+ app switch
+
+
+
+ menu
+ menu
+
+
+
+ home
+ home
+
+
+
+ return
+ return
+
+
+
+ videoForm
+
+
+ qrc:/qml/pinwheel.qml
+ qrc:/qml/pinwheel.qml
+
+
+
diff --git a/QtScrcpy/i18n/QtScrcpy_zh.qm b/QtScrcpy/i18n/QtScrcpy_zh.qm
new file mode 100644
index 0000000..61d13bf
Binary files /dev/null and b/QtScrcpy/i18n/QtScrcpy_zh.qm differ
diff --git a/QtScrcpy/i18n/QtScrcpy_zh.ts b/QtScrcpy/i18n/QtScrcpy_zh.ts
new file mode 100644
index 0000000..702e84b
--- /dev/null
+++ b/QtScrcpy/i18n/QtScrcpy_zh.ts
@@ -0,0 +1,128 @@
+
+
+
+
+ Dialog
+
+
+ Wireless
+ 无线
+
+
+
+ wireless connect
+ 无线连接
+
+
+
+ wireless disconnect
+ 无线断开
+
+
+
+ USB line
+ USB线
+
+
+
+ stop server
+ 停止服务
+
+
+
+ start server
+ 启动服务
+
+
+
+ device serial:
+ 设备序列号:
+
+
+
+ bit rate:
+ 比特率:
+
+
+
+ video size:
+ 视频尺寸:
+
+
+
+ start adbd
+ 启动adbd
+
+
+
+ get device ip
+ 获取设备IP
+
+
+
+ update device
+ 刷新设备列表
+
+
+
+ ToolForm
+
+
+ Tool
+ 工具
+
+
+
+ full screen
+ 全屏
+
+
+
+ turn off
+ 锁屏
+
+
+
+ turn on
+ 解锁
+
+
+
+ volume up
+ 音量加
+
+
+
+ volume down
+ 音量减
+
+
+
+ app switch
+ 切换应用
+
+
+
+ menu
+ 菜单
+
+
+
+ home
+ 主界面
+
+
+
+ return
+ 返回
+
+
+
+ videoForm
+
+
+ qrc:/qml/pinwheel.qml
+ qrc:/qml/pinwheel.qml
+
+
+
diff --git a/QtScrcpy/main.cpp b/QtScrcpy/main.cpp
index c0339e7..4e5174a 100644
--- a/QtScrcpy/main.cpp
+++ b/QtScrcpy/main.cpp
@@ -2,6 +2,7 @@
#include
#include
#include
+#include
#include "dialog.h"
#include "decoder.h"
@@ -10,6 +11,7 @@ Dialog* g_mainDlg = Q_NULLPTR;
QtMessageHandler g_oldMessageHandler = Q_NULLPTR;
void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg);
+void installTranslator();
int main(int argc, char *argv[])
{
@@ -21,6 +23,8 @@ int main(int argc, char *argv[])
Decoder::init();
QApplication a(argc, argv);
+ installTranslator();
+
#ifdef Q_OS_WIN32
qputenv("QTSCRCPY_ADB_PATH", "../../../third_party/adb/win/adb.exe");
qputenv("QTSCRCPY_SERVER_PATH", "../../../third_party/scrcpy-server.jar");
@@ -50,6 +54,24 @@ int main(int argc, char *argv[])
return ret;
}
+void installTranslator() {
+ static QTranslator translator;
+ QLocale locale;
+ QLocale::Language language = locale.language();
+ QString languagePath = ":i18n/";
+ switch (language) {
+ case QLocale::Chinese:
+ languagePath += "QtScrcpy_zh.qm";
+ break;
+ case QLocale::English:
+ default:
+ languagePath += "QtScrcpy_en.qm";
+ }
+
+ translator.load(languagePath);
+ qApp->installTranslator(&translator);
+}
+
void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
if (g_oldMessageHandler) {
diff --git a/QtScrcpy/res.qrc b/QtScrcpy/res.qrc
index 1db306c..62878b4 100644
--- a/QtScrcpy/res.qrc
+++ b/QtScrcpy/res.qrc
@@ -6,5 +6,7 @@
res/phone-v.png
qml/pinwheel.qml
qml/images/pinwheel.png
+ i18n/QtScrcpy_en.qm
+ i18n/QtScrcpy_zh.qm
diff --git a/QtScrcpy/toolform.ui b/QtScrcpy/toolform.ui
index 54b0555..59c1b63 100644
--- a/QtScrcpy/toolform.ui
+++ b/QtScrcpy/toolform.ui
@@ -16,6 +16,9 @@
-
+
+ full screen
+
@@ -36,6 +39,9 @@
-
+
+ turn off
+
@@ -43,6 +49,9 @@
-
+
+ turn on
+
@@ -50,6 +59,9 @@
-
+
+ volume up
+
@@ -57,6 +69,9 @@
-
+
+ volume down
+
@@ -64,6 +79,9 @@
-
+
+ app switch
+
@@ -71,6 +89,9 @@
-
+
+ menu
+
@@ -78,6 +99,9 @@
-
+
+ home
+
@@ -85,6 +109,9 @@
-
+
+ return
+
diff --git a/QtScrcpy/uibase/magneticwidget.ui b/QtScrcpy/uibase/magneticwidget.ui
index c600e01..0b3e9eb 100644
--- a/QtScrcpy/uibase/magneticwidget.ui
+++ b/QtScrcpy/uibase/magneticwidget.ui
@@ -11,21 +11,8 @@
- Form
+
-
-
-
- 80
- 110
- 93
- 28
-
-
-
- PushButton
-
-
diff --git a/all.pro b/all.pro
index f4cda48..aa4e301 100644
--- a/all.pro
+++ b/all.pro
@@ -1,2 +1,7 @@
TEMPLATE = subdirs
-SUBDIRS = QtScrcpy
\ No newline at end of file
+SUBDIRS = QtScrcpy
+
+# 多语言翻译文件
+TRANSLATIONS = \
+ $$PWD/QtScrcpy/res/i18n/QtScrcpy_zh.ts \
+ $$PWD/QtScrcpy/res/i18n/QtScrcpy_en.ts