diff --git a/QtScrcpy/QtScrcpyCore/src/device/controller/inputconvert/inputconvertgame.cpp b/QtScrcpy/QtScrcpyCore/src/device/controller/inputconvert/inputconvertgame.cpp index e0871f8..88b584e 100644 --- a/QtScrcpy/QtScrcpyCore/src/device/controller/inputconvert/inputconvertgame.cpp +++ b/QtScrcpy/QtScrcpyCore/src/device/controller/inputconvert/inputconvertgame.cpp @@ -624,7 +624,7 @@ void InputConvertGame::stopMouseMoveTimer() bool InputConvertGame::switchGameMap() { m_gameMap = !m_gameMap; - qInfo() << tr("current keymap mode: %1").arg(m_gameMap ? tr("custom") : tr("normal")); + qInfo() << QString("current keymap mode: %1").arg(m_gameMap ? "custom" : "normal"); if (!m_keyMap.isValidMouseMoveMap()) { return m_gameMap; diff --git a/QtScrcpy/QtScrcpyCore/src/device/controller/inputconvert/keymap/keymap.cpp b/QtScrcpy/QtScrcpyCore/src/device/controller/inputconvert/keymap/keymap.cpp index 446096f..2e810fd 100644 --- a/QtScrcpy/QtScrcpyCore/src/device/controller/inputconvert/keymap/keymap.cpp +++ b/QtScrcpy/QtScrcpyCore/src/device/controller/inputconvert/keymap/keymap.cpp @@ -290,7 +290,7 @@ void KeyMap::loadKeyMap(const QString &json) } // this must be called after m_keyMapNodes is stable makeReverseMap(); - qInfo() << tr("Script updated, current keymap mode:normal, Press ~ key to switch keymap mode"); + qInfo() << "Script updated, current keymap mode:normal, Press ~ key to switch keymap mode"; parseError: if (!errorString.isEmpty()) { diff --git a/QtScrcpy/QtScrcpyCore/src/device/device.cpp b/QtScrcpy/QtScrcpyCore/src/device/device.cpp index 7938606..c62cdd5 100644 --- a/QtScrcpy/QtScrcpyCore/src/device/device.cpp +++ b/QtScrcpy/QtScrcpyCore/src/device/device.cpp @@ -148,19 +148,19 @@ void Device::initSignals() connect(m_fileHandler, &FileHandler::fileHandlerResult, this, [this](FileHandler::FILE_HANDLER_RESULT processResult, bool isApk) { QString tipsType = ""; if (isApk) { - tipsType = tr("install apk"); + tipsType = "install apk"; } else { - tipsType = tr("file transfer"); + tipsType = "file transfer"; } QString tips; if (FileHandler::FAR_IS_RUNNING == processResult) { - tips = tr("wait current %1 to complete").arg(tipsType); + tips = QString("wait current %1 to complete").arg(tipsType); } if (FileHandler::FAR_SUCCESS_EXEC == processResult) { - tips = tr("%1 complete, save in %2").arg(tipsType).arg(m_params.pushFilePath); + tips = QString("%1 complete, save in %2").arg(tipsType).arg(m_params.pushFilePath); } if (FileHandler::FAR_ERROR_EXEC == processResult) { - tips = tr("%1 failed").arg(tipsType); + tips = QString("%1 failed").arg(tipsType); } qInfo() << tips; }); diff --git a/QtScrcpy/res/i18n/CMakeLists.txt b/QtScrcpy/res/i18n/CMakeLists.txt index 6fd32cd..bf3dad8 100644 --- a/QtScrcpy/res/i18n/CMakeLists.txt +++ b/QtScrcpy/res/i18n/CMakeLists.txt @@ -38,7 +38,10 @@ qt5_create_translation在cmake clean的时候会删除翻译好的ts文件,导 上面3个方案都有一个共同问题:就是翻译文件处理都是和编译绑定在一起的,每次编译都会检测执行,实际的翻译工作是所有 编程工作都完成以后,统一执行一次lupdate、翻译、lrelease就可以了,不应该和编译绑定在一起 -所以写两个shell脚本lupdate.sh和lrelease.sh来处理比较合适 +所以写两个shell脚本lupdate.sh和lrelease.sh来处理比较合适,其实非常简单: +1. 更新ts:lupdate -no-obsolete ./QtScrcpy -ts ./QtScrcpy/res/i18n/en_US.ts ./QtScrcpy/res/i18n/zh_CN.ts +2. 手动翻译ts +3. 发布:lrelease ./QtScrcpy/res/i18n/en_US.ts ./QtScrcpy/res/i18n/zh_CN.ts 参考文档 1. qt知道qt5_create_translation的bug,但是不肯解决,只确定了qt6没问题 https://bugreports.qt.io/browse/QTBUG-96549 diff --git a/QtScrcpy/res/i18n/en_US.qm b/QtScrcpy/res/i18n/en_US.qm index 65c8125..e64c864 100644 Binary files a/QtScrcpy/res/i18n/en_US.qm and b/QtScrcpy/res/i18n/en_US.qm differ diff --git a/QtScrcpy/res/i18n/en_US.ts b/QtScrcpy/res/i18n/en_US.ts index 213c7b0..986bd01 100644 --- a/QtScrcpy/res/i18n/en_US.ts +++ b/QtScrcpy/res/i18n/en_US.ts @@ -1,46 +1,6 @@ - - Device - - wait current file transfer to complete - wait current file transfer to complete - - - file transfer complete - file transfer complete - - - file transfer failed - file transfer failed - - - install apk - install apk - - - file transfer - file transfer - - - wait current %1 to complete - wait current %1 to complete - - - %1 complete, save in %2 - %1 complete, save in %2 - - - %1 complete - save in %2 - %1 complete\n save in %2 - - - %1 failed - %1 failed - - Dialog @@ -149,10 +109,6 @@ reverse connection reverse connection - - auto enable - auto enable - background record background record @@ -197,10 +153,6 @@ device serial: device serial: - - Config - Config - bit rate: bit rate: @@ -231,31 +183,6 @@ no lock no lock - - warning - Warning - Warning - - - Quit or set tray? - Quit or set tray? - Quit or set tray? - - - Quit - Quit - Quit - - - Set tray - Set tray - Set tray - - - Cancel - Cancel - Cancel - Notice Notice @@ -266,52 +193,12 @@ Hidden here! Hidden here! - - 2 - - - - - InputConvertGame - - current keymap mode: %1 - - - - custom - - - - normal - - - - - KeyMap - - Script updated, current keymap mode:normal, Press ~ key to switch keymap mode - - QObject - - This software is completely open source and free, you can download it at the following address: - This software is completely open source and free, you can download it at the following address: - - - This software is completely open source and free. -Strictly used for illegal purposes, or at your own risk. -You can download it at the following address: - This software is completely open source and free.\nStrictly used for illegal purposes, or at your own risk.\nYou can download it at the following address: - - - This software is completely open source and free. Strictly used for illegal purposes, or at your own risk. You can download it at the following address: - This software is completely open source and free. Strictly used for illegal purposes, or at your own risk. You can download it at the following address: - This software is completely open source and free. Use it at your own risk. You can download it at the following address: - + This software is completely open source and free. Use it at your own risk. You can download it at the following address: @@ -328,14 +215,6 @@ You can download it at the following address: expand notify expand notify - - turn off - turn off - - - turn on - turn on - touch switch touch switch @@ -380,31 +259,16 @@ You can download it at the following address: open screen open screen + + group control + group control + VideoForm - - wait current file transfer to complete - wait current file transfer to complete - - - file transfer complete - file transfer complete - - - file transfer failed - file transfer failed - file does not exist file does not exist - - videoForm - - qrc:/qml/pinwheel.qml - qrc:/qml/pinwheel.qml - - diff --git a/QtScrcpy/res/i18n/zh_CN.qm b/QtScrcpy/res/i18n/zh_CN.qm index 0e05298..b98cc9c 100644 Binary files a/QtScrcpy/res/i18n/zh_CN.qm and b/QtScrcpy/res/i18n/zh_CN.qm differ diff --git a/QtScrcpy/res/i18n/zh_CN.ts b/QtScrcpy/res/i18n/zh_CN.ts index 8babd7b..a356f7e 100644 --- a/QtScrcpy/res/i18n/zh_CN.ts +++ b/QtScrcpy/res/i18n/zh_CN.ts @@ -1,46 +1,6 @@ - - Device - - wait current file transfer to complete - 等待当前文件传输完成 - - - file transfer complete - 文件传输完成 - - - file transfer failed - 文件传输失败 - - - install apk - 安装apk - - - file transfer - 文件传输 - - - wait current %1 to complete - 等待当前%1完成 - - - %1 complete, save in %2 - %1完成,保存在%2 - - - %1 complete - save in %2 - %1完成\n 保存在 %2 - - - %1 failed - %1 失败 - - Dialog @@ -149,10 +109,6 @@ reverse connection 反向连接 - - auto enable - 自动启用脚本 - background record 后台录制 @@ -197,10 +153,6 @@ device serial: 设备序列号: - - Config - 配置 - bit rate: 比特率: @@ -231,31 +183,6 @@ no lock 不锁定 - - warning - 警告 - 警告 - - - Quit or set tray? - 退出还是最小化到托盘? - 退出还是最小化到托盘? - - - Quit - 退出 - 退出 - - - Set tray - 最小化到系统托盘 - 最小化到系统托盘 - - - Cancel - 取消 - 取消 - Notice 提示 @@ -266,32 +193,6 @@ 安卓录屏程序隐藏在这! 安卓录屏程序隐藏在这! - - 2 - - - - - InputConvertGame - - current keymap mode: %1 - - - - custom - - - - normal - - - - - KeyMap - - Script updated, current keymap mode:normal, Press ~ key to switch keymap mode - - QObject @@ -314,14 +215,6 @@ expand notify 下拉通知 - - turn off - 锁屏 - - - turn on - 解锁 - touch switch 触摸显示开关 @@ -366,31 +259,16 @@ open screen 打开屏幕 + + group control + 群控 + VideoForm - - wait current file transfer to complete - 等待当前文件传输完成 - - - file transfer complete - 文件传输完成 - - - file transfer failed - 文件传输失败 - file does not exist 文件不存在 - - videoForm - - qrc:/qml/pinwheel.qml - qrc:/qml/pinwheel.qml - - diff --git a/QtScrcpy/ui/dialog.ui b/QtScrcpy/ui/dialog.ui index 1e5c829..97f4f0c 100644 --- a/QtScrcpy/ui/dialog.ui +++ b/QtScrcpy/ui/dialog.ui @@ -324,7 +324,7 @@ - 2 + 2 diff --git a/ci/lrelease.sh b/ci/lrelease.sh new file mode 100644 index 0000000..d3b2e4f --- /dev/null +++ b/ci/lrelease.sh @@ -0,0 +1,3 @@ +# https://doc.qt.io/qt-5/linguist-manager.html#lrelease +# lrelease -help +lrelease ./QtScrcpy/res/i18n/en_US.ts ./QtScrcpy/res/i18n/zh_CN.ts \ No newline at end of file diff --git a/ci/lupdate.sh b/ci/lupdate.sh new file mode 100644 index 0000000..92ef2f6 --- /dev/null +++ b/ci/lupdate.sh @@ -0,0 +1,4 @@ +# https://doc.qt.io/qt-5/linguist-manager.html#lupdate +# lupdate -help +# export PATH=/D/Qt/5.15.2/msvc2019/bin:$PATH +lupdate -no-obsolete ./QtScrcpy -ts ./QtScrcpy/res/i18n/en_US.ts ./QtScrcpy/res/i18n/zh_CN.ts \ No newline at end of file