From df7fb33be6d6b4bb3f67247d7703dfdc1e17533f Mon Sep 17 00:00:00 2001 From: yifang Date: Sun, 6 Mar 2022 17:05:43 +0800 Subject: [PATCH] optimize: add qtwebengine zh_CN support --- .github/scripts/windows-publish.ps1 | 6 +- main.cc | 36 +- thirdparty/qwebengine_ts/README.md | 7 + thirdparty/qwebengine_ts/qtwebengine_zh_CN.qm | Bin 0 -> 9727 bytes thirdparty/qwebengine_ts/qtwebengine_zh_CN.ts | 467 ++++++++++++++++++ 5 files changed, 493 insertions(+), 23 deletions(-) create mode 100644 thirdparty/qwebengine_ts/README.md create mode 100644 thirdparty/qwebengine_ts/qtwebengine_zh_CN.qm create mode 100644 thirdparty/qwebengine_ts/qtwebengine_zh_CN.ts diff --git a/.github/scripts/windows-publish.ps1 b/.github/scripts/windows-publish.ps1 index e93ed464..ee23b6a7 100644 --- a/.github/scripts/windows-publish.ps1 +++ b/.github/scripts/windows-publish.ps1 @@ -52,7 +52,11 @@ function Main() { Copy-Item $sdkDll $archiveName\ Copy-Item winlibs\lib\msvc\*.dll $archiveName\ Copy-Item locale\*.qm $archiveName\locale\ - # Copy-Item qtsingleapplication\lib\*.dll $archiveName\ + Write-Host "copy qwebengine zh_CN translation" + Copy-Item thirdparty\qwebengine_ts\*.qm $archiveName\locale\ + $webengineqm="{0}\translations\qtwebengine_*.qm" -f $env:Qt5_Dir + Write-Host "copy qtwebengine qm from $($webengineqm)" + Copy-Item $webengineqm $archiveName\locale\ Write-Host "compress zip..." # 打包zip Compress-Archive -Path $archiveName -DestinationPath $archiveName'.zip' diff --git a/main.cc b/main.cc index 426daebf..a032f45e 100644 --- a/main.cc +++ b/main.cc @@ -1,4 +1,4 @@ -/* This file is (c) 2008-2012 Konstantin Isakov +/* This file is (c) 2008-2012 Konstantin Isakov * Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */ #include @@ -385,31 +385,23 @@ int main( int argc, char ** argv ) if( !cfg.preferences.interfaceLanguage.isEmpty() && localeName != cfg.preferences.interfaceLanguage ) { localeName = cfg.preferences.interfaceLanguage; - QLocale locale( localeName ); - QLocale::setDefault( locale ); - if( !qtTranslator.load( "qt_" + localeName, Config::getLocDir() ) ) - { - qtTranslator.load( "qt_" + localeName, QLibraryInfo::location( QLibraryInfo::TranslationsPath ) ); - app.installTranslator( &qtTranslator ); - } - - translator.load( Config::getLocDir() + "/" + localeName ); - app.installTranslator( &translator ); } - else + + QLocale locale( localeName ); + QLocale::setDefault( locale ); + if( !qtTranslator.load( "qt_" + localeName, Config::getLocDir() ) ) { - QString localeName = QLocale::system().name(); + qtTranslator.load( "qt_" + localeName, QLibraryInfo::location( QLibraryInfo::TranslationsPath ) ); + app.installTranslator( &qtTranslator ); + } + translator.load( Config::getLocDir() + "/" + localeName ); + app.installTranslator( &translator ); - if( !qtTranslator.load( "qt_" + localeName, Config::getLocDir() ) ) - { - qtTranslator.load( "qt_" + localeName, QLibraryInfo::location( QLibraryInfo::TranslationsPath ) ); - - app.installTranslator( &qtTranslator ); - } - - translator.load( Config::getLocDir() + "/" + localeName ); - app.installTranslator( &translator ); + QTranslator webengineTs; + if( webengineTs.load( "qtwebengine_" + localeName, Config::getLocDir() ) ) + { + app.installTranslator( &webengineTs ); } // Prevent app from quitting spontaneously when it works with scan popup diff --git a/thirdparty/qwebengine_ts/README.md b/thirdparty/qwebengine_ts/README.md new file mode 100644 index 00000000..fcd9b261 --- /dev/null +++ b/thirdparty/qwebengine_ts/README.md @@ -0,0 +1,7 @@ +qt webengine lacks the translation of chinese . +this file is a compilation of this qwebengine_zh_CN.ts +(https://codereview.qt-project.org/c/qt/qttranslations/+/399180) . + +provided as a temporarily way to support zh_CN. + + diff --git a/thirdparty/qwebengine_ts/qtwebengine_zh_CN.qm b/thirdparty/qwebengine_ts/qtwebengine_zh_CN.qm new file mode 100644 index 0000000000000000000000000000000000000000..bb2eadc9ce075bf818b3e692351b22dcb4dde079 GIT binary patch literal 9727 zcmbVS3ve6N6@7LjTb3pH6UPoFB%6R8C*ByF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z3VJ?ilUklnq@MJ4{AX|c8d0bLEkWR)K!^BA&pn<2-9rtnT6>3qwk-6aB@BmI@`mLl znY33)kF#M3@mG~k9;^DC0*qFz`>PEgU2td*p*F;$C}QC^Ms9eeQ73#NqaS{6K??kq zket_?mPweSTj9oO!m0gQAE1DZEd_0CLn8bL@bV%WEXR2*yJ);+bbeRqwzZLiOpcMw zFt{!VEsKD5+VGBfQMZsRP^upm?EAh9X8qQNQt*x^9vrunKhQ#ANLwm<;4rt)5_AnA zJ!~wipllG21A`*$ovcHv02I7eZpXah(+;VYZl|H=W@#0YT4$?}jE%^2ekWd`W7&xu z#U`@!wjiP-C*9TDb(yZAdQ1aFhr`eZ(0Yi4>`*lk`Z-Qhm8walpg%~_)wg*9XVw%nr*ZdnuTo$`M&nWHh6Tg%C=q>8UzZ*!3kG{mZ146`r8NJ z)8$Jq7sNEJbq5MAg{9{}>_=l_a2g;NK;~$h9+95V#VqRuja?UnswO+%KIPiJJUd>^ z_jbJOHfOGJf@4VC_cV^3LJBIiT(@uca(!x6FI*+5{Jo%%iwJE@k*;IxB15xfnkufI zT(nlBBxkgaQ9*SUa?z#RVDaOyV7?@Kjtp+oWlFR&lc|)Au)6Vy93bp%a*3=;kIR@c zRhp#U1$_^P^N?P?%zQ6M8yJI#adMU`&=j>++1?hiN=OoT#_8$mZ*fd{v_ zKO*-m{$}@axrCZQh!l0sXuUqG8L;hHL1L8 zDQZEB;imyDL)75yKAZzd^^?2rpfh+2>DKCii`z)2i`+Ge>J1?2UF2G}RKPRvc;Ky}u_e1;O)%(P==B7G>MaTR#|5~( shW`*C2UK8SltBI;ggn#~m`9>W78pUT7}Y>1RbIu*(#kNMgq1J)KQjTpF8}}l literal 0 HcmV?d00001 diff --git a/thirdparty/qwebengine_ts/qtwebengine_zh_CN.ts b/thirdparty/qwebengine_ts/qtwebengine_zh_CN.ts new file mode 100644 index 00000000..dd149bd5 --- /dev/null +++ b/thirdparty/qwebengine_ts/qtwebengine_zh_CN.ts @@ -0,0 +1,467 @@ + + + + + DownloadInterruptReason + + Unknown reason or not interrupted + 未知原因或非中断 + + + General file operation failure + 文件操作失败 + + + The file cannot be written locally, due to access restrictions + 由于访问限制,该文件无法在本地写入 + + + Insufficient space on the target drive + 目标驱动器上的空间不足 + + + The directory or file name is too long + 目录或文件名太长 + + + The file size exceeds the file system limitation + 文件大小超过文件系统限制 + + + The file is infected with a virus + 该文件感染了病毒 + + + Temporary problem (for example file in use, or too many open files) + 临时问题(例如文件正在使用或打开的文件太多) + + + The file was blocked due to local policy + 由于本地政策,该文件被阻止 + + + Checking the safety of the download failed due to unexpected reasons + 由于意外原因,检查下载的安全性失败 + + + File seek past the end of a file (resuming previously interrupted download) + 文件搜索超过文件末尾(恢复先前中断的下载) + + + The partial file did not match the expected hash + 部分文件与预期的哈希不匹配 + + + General network failure + 一般网络故障 + + + The network operation has timed out + 网络操作超时 + + + The network connection has been terminated + 网络连接已终止 + + + The server has gone down + 服务器宕机了 + + + The network request was invalid (for example, the URL or scheme is invalid) + 网络请求无效(例如,URL或scheme无效) + + + General server failure + 一般服务器故障 + + + The server does not have the requested data + 服务器没有请求的数据 + + + The server did not authorize access to the resource + 服务器未授权访问资源 + + + A problem with the server certificate occurred + 服务器证书出现问题 + + + Access forbidden by the server + 服务器禁止访问 + + + Unexpected server response + 意外的服务器响应 + + + Download canceled by the user + 下载被用户取消 + + + + QQuickPdfDocument + + no error + 无错误 + + + data not yet available + 数据不可用 + + + file not found + 文件未找到 + + + invalid file format + 无效文件格式 + + + incorrect password + 密码错误 + + + unsupported security scheme + 不支持的安全方案 + + + unknown error + 未知错误 + + + + QQuickWebEngineView + + Stop + 停止 + + + Reload and Bypass Cache + 重新加载和绕过缓存 + + + Open link in this window + 在当前窗口中打开链接 + + + Toggle Play/Pause + 播放/暂停 + + + Toggle Mute + 静音 + + + Close Page + 关闭页面 + + + Unselect + 取消选择 + + + &Bold + 加粗(&B) + + + &Italic + 斜体(&I) + + + &Underline + 下划线(&U) + + + &Strikethrough + 删除线(&S) + + + Align &Left + 左对齐(&L) + + + Align &Center + 居中(&C) + + + Align &Right + 右对齐(&R) + + + Align &Justified + 对齐(&J) + + + &Indent + 缩进(&I) + + + &Outdent + 突出(&O) + + + Insert &Ordered List + 插入有序列表(&O) + + + Insert &Unordered List + 插入无序列表(&U) + + + + QWebEnginePage + + Stop + 停止 + + + Reload and Bypass Cache + 重新加载和绕过缓存 + + + Toggle Play/Pause + 播放/暂停 + + + Toggle Mute + 静音 + + + Close Page + 关闭页面 + + + Unselect + 取消选择 + + + Are you sure you want to leave this page? Changes that you made may not be saved. + 您确定要离开此页面吗? 您所做的更改不会被保存。 + + + Open link in this window + 在当前窗口中打开链接 + + + Open link in new background tab + 在新的后台选项卡中打开链接 + + + &Bold + 加粗(&B) + + + &Italic + 斜体(&I) + + + &Underline + 下划线(&U) + + + &Strikethrough + 删除线(&S) + + + Align &Left + 左对齐(&L) + + + Align &Center + 居中(&C) + + + Align &Right + 右对齐(&R) + + + Align &Justified + 对齐(&J) + + + &Indent + 缩进(&I) + + + &Outdent + 突出(&O) + + + Insert &Ordered List + 插入有序列表(&O) + + + Insert &Unordered List + 插入无序列表(&U) + + + Select folder to upload + 选择要上传的文件夹 + + + + QtWebEnginePlugin + + Cannot create separate instance of WebEngineNewViewRequest + 无法创建 WebEngineNewViewRequest 的单独实例 + + + Cannot create separate instance of %1 + 无法创建 %1 的单独实例 + + + + QtWebEngineTestSupportPlugin + + Cannot create a separate instance of WebEngineErrorPage + 无法创建 WebEngineErrorPage 的单独实例 + + + Cannot create a separate instance of WebEngineTestEvent + 无法创建单独的 WebEngineTestEvent 实例 + + + + RenderViewContextMenuQt + + Back + 后退 + + + Forward + 前进 + + + Reload + 重载 + + + Cut + 剪切 + + + Copy + 复制 + + + Paste + 粘贴 + + + Undo + 撤销 + + + Redo + 恢复 + + + Select all + 全选 + + + Paste and match style + 粘贴并匹配样式 + + + Open link in new window + 在新窗口中打开链接 + + + Open link in new tab + 在新页签中打开链接 + + + Copy link address + 复制链接地址 + + + Save link + 保存链接 + + + Copy image + 复制图片 + + + Copy image address + 复制图片地址 + + + Save image + 保存图片 + + + Copy media address + 复制媒体链接 + + + Show controls + 显示控制 + + + Loop + 循环 + + + Save media + 保存媒体 + + + Inspect + 审核 + + + Exit full screen + 退出全屏 + + + Save page + 保存页面 + + + View page source + 查看页面源代码 + + + + UIDelegatesManager + + Javascript Alert - %1 + Javascript-警告 - %1 + + + Javascript Confirm - %1 + Javascript-确认 - %1 + + + Javascript Prompt - %1 + Javascript-提醒 - %1 + + + Are you sure you want to leave this page? + 您确定要离开当前页面吗? + + + Changes that you made may not be saved. + 您所做的更改不会被保存。 + + + Connect to proxy "%1" using: + 使用以下命令连接到代理“%1”: + + + Enter username and password for "%1" at %2://%3 + 在 %2://%3 输入“%1”的用户名和密码 + + + + WebContentsAdapter + + HTTP-POST data can only be sent over HTTP(S) protocol + HTTP-POST 数据只能通过 HTTP(S) 协议发送 + + +