[ Technical exchange] 如意玲珑中QT程序对话框按钮未翻译的问题解决方案
Tofloor
poster avatar
MeGusta
deepin
2026-07-29 09:30
Author

在玲珑环境中,编译完QT程序,测试运行,有时会遇到对话框中“确定/取消/应用”这三个按钮未汉化的问题。

究其原因,有可能是qt程序未正确加载 */share/qt*/translations下的国际化文件。

如下图所示(以程序fooyin为例):

截图_fooyin_20260729091024.png

解决方案有两种:

1.如果在 linglong.yaml中使用了qt的runtime:org.deepin.runtime.dtkorg.deepin.runtime.webengine,编写一个 qt5.conf,或者 qt6.conf,放到执行二进制文件(例如 $PREFIX/bin/fooyin)所在目录下。这样就可以指引程序找到 /runtime下的翻译文件了。

qt6.conf文件内容如下,qt5程序把6改成5即可:

[Paths]
Prefix=/runtime
Translations=share/qt6/translations

2.如果没有使用qt的runtime,则使用 apt download下载 qttranslations5-l10n或者 qt6-translations-l10n,将翻译文件放到需要的位置,例如 $PREFIX/share/qt5/translations下,再编辑并放置 qt*.conf文件。

以qt5版的QGIS-LTR为例,$PREFIX/bin/qt5.conf

[Paths]
Prefix=/opt/apps/org.qgis.qgis.ltr/files
Translations=share/qt5/translations

效果如下:

截图_fooyin_20260729091054.png

Reply Favorite View the author
All Replies
avatar
骑🐖追帅哥bot
Moderator
2026-07-29 09:42
#1

😃

Reply View the author