From f588a9de52b4de8a3f519d61e6c7d574a0bb7a3e Mon Sep 17 00:00:00 2001
From: Barry <870709864@qq.com>
Date: Sat, 26 Jan 2019 17:01:25 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=9A=E8=AF=AD=E8=A8=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
QtScrcpy/QtScrcpy.pro | 2 -
QtScrcpy/dialog.ui | 13 ++-
QtScrcpy/i18n/QtScrcpy_en.qm | Bin 0 -> 1578 bytes
QtScrcpy/i18n/QtScrcpy_en.ts | 128 ++++++++++++++++++++++++++++++
QtScrcpy/i18n/QtScrcpy_zh.qm | Bin 0 -> 1295 bytes
QtScrcpy/i18n/QtScrcpy_zh.ts | 128 ++++++++++++++++++++++++++++++
QtScrcpy/main.cpp | 22 +++++
QtScrcpy/res.qrc | 2 +
QtScrcpy/toolform.ui | 27 +++++++
QtScrcpy/uibase/magneticwidget.ui | 15 +---
all.pro | 7 +-
11 files changed, 324 insertions(+), 20 deletions(-)
create mode 100644 QtScrcpy/i18n/QtScrcpy_en.qm
create mode 100644 QtScrcpy/i18n/QtScrcpy_en.ts
create mode 100644 QtScrcpy/i18n/QtScrcpy_zh.qm
create mode 100644 QtScrcpy/i18n/QtScrcpy_zh.ts
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 0000000000000000000000000000000000000000..ed7808850d274d10e1ca5697eb66bf7575e5a60b
GIT binary patch
literal 1578
zcmZ{kJ7^S96o$`cAG42S2{DN=CNd%jM#vVT;1UpGR1_OYmRJOFcIIyO!pz*sJa#38
zm4!%@G_f&7v`#H4A}ItxL9h`k3l+uACTQz_XP4P$Se7$)_J05Q&$;LB+@3M<;m`Kg
z$J0{>_g}vGI!{D2E2+)=0``}b8|QywP0GgpGwA+ScAxGc
zPAk7=zC-_o^6%z7tnX&DPYJBgWZzxeLj00Tj_gABF!x@WMZ7(@>DCaB=TBaK1l=7@
zl)Mv%@GzBVk>*JylQ`ML(lT8N-*jnlUNyPR6!~I-Yo=I@HIQX&b%_CCeAyYcZ57vw~xcfvW(7mh5u4?9T#IHTF@j@qN-LxE$U?ajh_v&+WIo{2C&
zr*%BHjxAT?1{12s*Lx36r8?NQ34wwR9a|03+A3vwfrths=^9yVyDBj+=Q+Mk#NFdcF?Oh
z7&`Fb$!&9ya+x2veGCkv)^IEA3zSlc^wSbhMWxc4Bi{kFYE>FYpETpR-8cuNl4Zy-
z6*%t}nX3siurQ*c-iIFPqA~K3%}kRF!t31Gv>94M7j!C80Z$h47jVe(->;6oGki>%
mZTu4Hjjg$Qv9M;D1&7=9Dr4p>7P1GK@FIjW^BBv4SnNNaNHahH
literal 0
HcmV?d00001
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 0000000000000000000000000000000000000000..61d13bf60f55960cad2044a60d369401521123b6
GIT binary patch
literal 1295
zcmZ{iO=uHQ5XUEGo85dgh*DboV!de#&8dp9BE)K`h_;(X5o0vjeMy#Xvgv*#>Y|L4tn(>^UV
zz5RJ7|8D!1nX{8Gz61bZ8tR^g0oDb;@w*MpG12
z1Ka+s6PQ1?yFY9LuwSyjc42ORQpd)daecsXZs{sU!7=LXK>ick*|Ll|u*1)9Am?SL
zu1}+Xg8kO~75{g#D_s%HZ#kpy8N|N3W)J3Z-E`M&m_mNh{f2GD81am1S&VJo&3i5)
z?~wtReRfoE5P~2C24*;`jKf+91p~YyrwMBzmik
z>zDs-qK?j(Z17stApT0$bM56xHZmeK23N{>uSBx4NO+xSSiM>__$>I*5<(Yr(<1c=
zV(=xQoT)0*>l5xn6eNg&L^Uqmh-wBOm10t*fU^XNdSQ~no+6B!$`Y*#?+*9HR^e{l
zP%~BwHE55pn>?~Q5E`!}X@Pn(BjF*Hny9Sc8k)U57WSX|Q+819tSk|g*X0Yo~gCJTe}mG?P?Q
zh1p%b17`4ZF!Ucvk+fOu#f;1!U!agfBZjHfD9Pk)W!vK{h*#tB8h%4dc^ma(i(m~y
z$M~
+
+
+
+ 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