mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-04-20 03:25:02 +00:00
feat: good translate
This commit is contained in:
parent
f190f9b17d
commit
03c33a3812
11 changed files with 28 additions and 276 deletions
|
@ -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;
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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;
|
||||
});
|
||||
|
|
|
@ -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
|
||||
|
|
Binary file not shown.
|
@ -1,46 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="en_US">
|
||||
<context>
|
||||
<name>Device</name>
|
||||
<message>
|
||||
<source>wait current file transfer to complete</source>
|
||||
<translation type="vanished">wait current file transfer to complete</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>file transfer complete</source>
|
||||
<translation type="vanished">file transfer complete</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>file transfer failed</source>
|
||||
<translation type="vanished">file transfer failed</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>install apk</source>
|
||||
<translation>install apk</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>file transfer</source>
|
||||
<translation>file transfer</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>wait current %1 to complete</source>
|
||||
<translation>wait current %1 to complete</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 complete, save in %2</source>
|
||||
<translation>%1 complete, save in %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 complete
|
||||
save in %2</source>
|
||||
<translation type="vanished">%1 complete\n save in %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 failed</source>
|
||||
<translation>%1 failed</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Dialog</name>
|
||||
<message>
|
||||
|
@ -149,10 +109,6 @@
|
|||
<source>reverse connection</source>
|
||||
<translation>reverse connection</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>auto enable</source>
|
||||
<translation type="vanished">auto enable</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>background record</source>
|
||||
<translation>background record</translation>
|
||||
|
@ -197,10 +153,6 @@
|
|||
<source>device serial:</source>
|
||||
<translation>device serial:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Config</source>
|
||||
<translation type="vanished">Config</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>bit rate:</source>
|
||||
<translation>bit rate:</translation>
|
||||
|
@ -231,31 +183,6 @@
|
|||
<source>no lock</source>
|
||||
<translation>no lock</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>warning</source>
|
||||
<translatorcomment>Warning</translatorcomment>
|
||||
<translation type="vanished">Warning</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Quit or set tray?</source>
|
||||
<translatorcomment>Quit or set tray?</translatorcomment>
|
||||
<translation type="vanished">Quit or set tray?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Quit</source>
|
||||
<translatorcomment>Quit</translatorcomment>
|
||||
<translation type="vanished">Quit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Set tray</source>
|
||||
<translatorcomment>Set tray</translatorcomment>
|
||||
<translation type="vanished">Set tray</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translatorcomment>Cancel</translatorcomment>
|
||||
<translation type="vanished">Cancel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Notice</source>
|
||||
<translatorcomment>Notice</translatorcomment>
|
||||
|
@ -266,52 +193,12 @@
|
|||
<translatorcomment>Hidden here!</translatorcomment>
|
||||
<translation>Hidden here!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>2</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>InputConvertGame</name>
|
||||
<message>
|
||||
<source>current keymap mode: %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>custom</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>normal</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>KeyMap</name>
|
||||
<message>
|
||||
<source>Script updated, current keymap mode:normal, Press ~ key to switch keymap mode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<source>This software is completely open source and free, you can download it at the following address:</source>
|
||||
<translation type="vanished">This software is completely open source and free, you can download it at the following address:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>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:</source>
|
||||
<translation type="vanished">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:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>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:</source>
|
||||
<translation type="vanished">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:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>This software is completely open source and free. Use it at your own risk. You can download it at the following address:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>This software is completely open source and free. Use it at your own risk. You can download it at the following address:</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -328,14 +215,6 @@ You can download it at the following address:</source>
|
|||
<source>expand notify</source>
|
||||
<translation>expand notify</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>turn off</source>
|
||||
<translation type="vanished">turn off</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>turn on</source>
|
||||
<translation type="vanished">turn on</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>touch switch</source>
|
||||
<translation>touch switch</translation>
|
||||
|
@ -380,31 +259,16 @@ You can download it at the following address:</source>
|
|||
<source>open screen</source>
|
||||
<translation>open screen</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>group control</source>
|
||||
<translation>group control</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>VideoForm</name>
|
||||
<message>
|
||||
<source>wait current file transfer to complete</source>
|
||||
<translation type="vanished">wait current file transfer to complete</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>file transfer complete</source>
|
||||
<translation type="vanished">file transfer complete</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>file transfer failed</source>
|
||||
<translation type="vanished">file transfer failed</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>file does not exist</source>
|
||||
<translation>file does not exist</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>videoForm</name>
|
||||
<message>
|
||||
<source>qrc:/qml/pinwheel.qml</source>
|
||||
<translation type="vanished">qrc:/qml/pinwheel.qml</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
|
Binary file not shown.
|
@ -1,46 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="zh_CN">
|
||||
<context>
|
||||
<name>Device</name>
|
||||
<message>
|
||||
<source>wait current file transfer to complete</source>
|
||||
<translation type="vanished">等待当前文件传输完成</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>file transfer complete</source>
|
||||
<translation type="vanished">文件传输完成</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>file transfer failed</source>
|
||||
<translation type="vanished">文件传输失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>install apk</source>
|
||||
<translation>安装apk</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>file transfer</source>
|
||||
<translation>文件传输</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>wait current %1 to complete</source>
|
||||
<translation>等待当前%1完成</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 complete, save in %2</source>
|
||||
<translation>%1完成,保存在%2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 complete
|
||||
save in %2</source>
|
||||
<translation type="vanished">%1完成\n 保存在 %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>%1 failed</source>
|
||||
<translation>%1 失败</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Dialog</name>
|
||||
<message>
|
||||
|
@ -149,10 +109,6 @@
|
|||
<source>reverse connection</source>
|
||||
<translation>反向连接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>auto enable</source>
|
||||
<translation type="vanished">自动启用脚本</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>background record</source>
|
||||
<translation>后台录制</translation>
|
||||
|
@ -197,10 +153,6 @@
|
|||
<source>device serial:</source>
|
||||
<translation>设备序列号:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Config</source>
|
||||
<translation type="vanished">配置</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>bit rate:</source>
|
||||
<translation>比特率:</translation>
|
||||
|
@ -231,31 +183,6 @@
|
|||
<source>no lock</source>
|
||||
<translation>不锁定</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>warning</source>
|
||||
<translatorcomment>警告</translatorcomment>
|
||||
<translation type="vanished">警告</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Quit or set tray?</source>
|
||||
<translatorcomment>退出还是最小化到托盘?</translatorcomment>
|
||||
<translation type="vanished">退出还是最小化到托盘?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Quit</source>
|
||||
<translatorcomment>退出</translatorcomment>
|
||||
<translation type="vanished">退出</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Set tray</source>
|
||||
<translatorcomment>最小化到系统托盘</translatorcomment>
|
||||
<translation type="vanished">最小化到系统托盘</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cancel</source>
|
||||
<translatorcomment>取消</translatorcomment>
|
||||
<translation type="vanished">取消</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Notice</source>
|
||||
<translatorcomment>提示</translatorcomment>
|
||||
|
@ -266,32 +193,6 @@
|
|||
<translatorcomment>安卓录屏程序隐藏在这!</translatorcomment>
|
||||
<translation>安卓录屏程序隐藏在这!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>2</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>InputConvertGame</name>
|
||||
<message>
|
||||
<source>current keymap mode: %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>custom</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>normal</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>KeyMap</name>
|
||||
<message>
|
||||
<source>Script updated, current keymap mode:normal, Press ~ key to switch keymap mode</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
|
@ -314,14 +215,6 @@
|
|||
<source>expand notify</source>
|
||||
<translation>下拉通知</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>turn off</source>
|
||||
<translation type="vanished">锁屏</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>turn on</source>
|
||||
<translation type="vanished">解锁</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>touch switch</source>
|
||||
<translation>触摸显示开关</translation>
|
||||
|
@ -366,31 +259,16 @@
|
|||
<source>open screen</source>
|
||||
<translation>打开屏幕</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>group control</source>
|
||||
<translation>群控</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>VideoForm</name>
|
||||
<message>
|
||||
<source>wait current file transfer to complete</source>
|
||||
<translation type="vanished">等待当前文件传输完成</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>file transfer complete</source>
|
||||
<translation type="vanished">文件传输完成</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>file transfer failed</source>
|
||||
<translation type="vanished">文件传输失败</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>file does not exist</source>
|
||||
<translation>文件不存在</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>videoForm</name>
|
||||
<message>
|
||||
<source>qrc:/qml/pinwheel.qml</source>
|
||||
<translation type="vanished">qrc:/qml/pinwheel.qml</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
|
|
@ -324,7 +324,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>2</string>
|
||||
<string notr="true">2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
3
ci/lrelease.sh
Normal file
3
ci/lrelease.sh
Normal file
|
@ -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
|
4
ci/lupdate.sh
Normal file
4
ci/lupdate.sh
Normal file
|
@ -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
|
Loading…
Add table
Reference in a new issue