From 4109c4724d9899ff7a5d01dec3a043c43c629b9e 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
zcmcE7ks@*G{hX<16=n7(EZlq7iGhJ(2LtQ27zPHWFAQwoOc@xMr!lbGgfcKN?`JR*
zUBtk^7{kz`>CC{uV9dzQ<;B3jB*|zmyMTd#;UP2kRXGL*mOAFcTniW&SoW~8r)e=T
zFw9}Ac-+Onz>vl^fzO43fhm;TUHd5m0|Ntl&z?R82Id#+YkGGuFfhxqKht`|z`!`0
z{kvxz0|RpeXW|7G1_nlDu4ArK85kI^bF&JqVPIhS!hMomkAZ>3hi5`j83O~0IG?m-
z3j+hwf=mVm)<9+k1_l9!P=;UzCk6$E9EMDWJcd*bkacVf3=ABh!A=S}nR%(~3=9lx
zE}4lr`RR-hE#VBA3`Gp73^@#`48;t^2rc26MX5Qd#l`4agcy<-G8sx36c~ya5*bPu
zQW>n^nmCg(OB9L{OH!@Sb;&TKFr+e+F=R3%Go&&oFcdSSG88dnG9)tOAnE5zNiEAv
zPE{yQEy_&H!7xOMA)O%=Y&EK3nG6MRC-A1HmMB1t$t*y3h6qD3LkUA7LlM}NM1~ZG
zB!(2YUasPj#G(>~#FV5Ibd3@y8X>MP1Ni~2nFpe|IJKxOwFq6i7+8BgLjm0DsG7Np
zOY#dq-o~O=ilLODfFT7M*b2x23AdcLv>+w1Bo*p$Oxr;L4+^tF|~RVdNMU6z@W
zny*ltS%n#K3Jm3_DTG0RA(Na4MHmtp3ZUT+@=*yx
zGD8Mj6IWtEfkJV4W=V1erdBbAG=@@!9EKcl;3b2zODaPiTr+oCX-fkkj!AkpwCdqkjs$6pwCbM
zF8#_GG8j_91)Cm32JUUq!lGm={leTF{esNA@{H8f9KFI^aFXE!X9RGX>0n@BU}9th
E0G~)RKmY&$
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
zcmcE7ks@*G{hX<16=n7(EZlq7iGhJ(2LtQ27zPF=CkD1}rVI>BhZxvxLKzsCUNV@8
zE@EI{lwj!5bY@^+&}L-k@?v0MT*+uJyMTd#VKX!LRXGL*<~HWTTniW&n76R9r)e=T
zFx0VCJnmv(U_Yfq{b|lp&bGsct_9$Qm|~NNBK=LQZC0Dmw!M1Di``VorWKBSH}nD;h9CLIjP0P=*l>~#FV5IbPXIJ4e7i=3*m}+Ac~7qi^@`qFq8+xWGA60=PoYEF93M~i)x-A
z^VAI>9|VbaWWX)pEiFh%EJ=lW0^J6#&SNts##lxFKnf`Cvdom!e1+o7D$Jne0L51S
zz2v2E^99PGF{Y55pO=@KT!L-|SWD{Kcm}u@VYrr*%win6SYn?Bmcw;Hp_N@^isy7u5wU&3A%B5sGqC^GY$zV(GsUb`P$Itthpmv!JMhQ++j$5R>M=CMN*Vlj|y`saz~1JA=%a+l@jl;)-?q~w?5QXRAau9_37
zx)hx3QN69jP{>fkkj!AkpwCdqkjs$6pwCdikjaq8P|lFSkjjwCki(z{k%5~hT3D29
drC*qvqhFAjSDulYnxj{k3yxGyaDoHJDgdv%A=Ur@
literal 0
HcmV?d00001
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