在处理QUiloader时Qt翻译问题(Qt translations issue while dealing with QUiloader)

编程入门 行业动态 更新时间:2024-10-07 04:29:28
在处理QUiloader时Qt翻译问题(Qt translations issue while dealing with QUiloader)

我正在使用QUILoader来动态加载.pro项目文件中未列出的.ui文件。

到现在为止还挺好。 问题是lupdate只翻译它在.pro文件下看到的内容。 我正在使用以下命令运行它:

lupdate project.pro -ts tr_language.ts

所以我错过了.ui文件中的所有文本。

我设法发现如果我按下以下命令,lupdate可以翻译widget.ui:

lupdate widget.ui -ts tr_language.ts

这样做我可以翻译.ui的东西。

有什么问题? 我只能做上面提到的方法之一,因为它们互相覆盖。

这个问题有更聪明的方法吗?

I'm using QUiloader to dynamically load .ui files which are not listed in the .pro project file.

So far so good. The issue is that lupdate only translates what it see under the .pro file. I'm running it with the following command:

lupdate project.pro -ts tr_language.ts

So I'm missing all the text in the .ui file.

I managed to discover lupdate can translate the widget.ui if I push the following command:

lupdate widget.ui -ts tr_language.ts

Doing so I can get the .ui stuff translated.

What's the problem? I can do only one of the above mentioned approaches, as they overwrite each other.

Is there a smarter approach for this issue?

最满意答案

这个问题有更聪明的方法吗?

简单:不要覆盖文件。 只是用

lupdate widget.ui -ts tr_widget_language.ts

或者你的ts的任何其他名称。 这样您就有两个不会相互覆盖的文件。

之后你可以使用:

lrelease [options] ts-files [-qm qm-file]

它提到ts文件作为参数。 有了这个,你应该能够将多个* .ts文件编译成一个* .qm文件。

否则,您必须在应用程序中加载第二个* .qm文件。

Is there a smarter approach for this issue?

Simple: Do not overwrite the file. Just use

lupdate widget.ui -ts tr_widget_language.ts

or any other name for your ts. This way you have two files which do not overwrite each other.

After that you can use:

lrelease [options] ts-files [-qm qm-file]

It mentions ts-files as argument. With this you should be able to compile multiple *.ts files into one *.qm File.

Otherwise you would have to load the second *.qm File in your application.

更多推荐

本文发布于:2023-08-07 13:02:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1464130.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Qt   QUiloader   translations   dealing   issue

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!