Qt文档的自动翻译

Automated translation of Qt documentation

Qt文档的自动翻译

February 23, 2023 by veshivas | Comments

2023年2月23日,veshivas,评论

Qt is known for its good documentation, and in the recent years the number of users that rely on the documentation has grown considerably. Some of these users also prefer using the documentation in a specific language, so they use the auto-translation tools for the purpose. Most of these tools translate everything on a page to the chosen language, unless they are told not to. For example, the following screenshot shows the Google translate output of the QString API reference in French language:

Qt以其良好的文档而闻名,近年来,依赖文档的用户数量大幅增长。其中一些用户还喜欢使用特定语言的文档,因此他们使用自动翻译工具。大多数这些工具都会将页面上的所有内容翻译成所选语言,除非他们被告知不这样做。例如,下面的屏幕截图显示了QString API引用的谷歌翻译输出(法语):

Notice that the API summary for QString is also translated, changing the methods and properties' name.

请注意,QString的API摘要也会被转换,从而更改了方法和属性的名称。

How do we tackle this problem?

我们如何解决这个问题?

The auto-translation tools can be informed to skip some parts of the documentation, especially the API reference summary. There are several ways to do this, and one of them is to use the translate attribute.

可以通知自动翻译工具跳过文档的某些部分,特别是API参考摘要。有几种方法可以做到这一点,其中之一就是使用translate属性。

The QDoc tool that we use to generate the documentation, adds the "translate=no" attribute to the HTML blocks that should not be translated. This attribute enables the translation tools to skip those blocks when the user tries to translate a page, offering a better translation experience.

我们用来生成文档的QDoc工具将“translate=no”属性添加到不应该翻译的HTML块中。此属性允许翻译工具在用户尝试翻译页面时跳过这些块,从而提供更好的翻译体验。

Is QDoc your documentation generator?

QDoc是您的文档生成器吗?

If you are using QDoc to generate documentation for your project, note that you can choose between HTML and DocBook XML as output format. Similar to the HTML output, QDoc generates DocBook XML with necessary metadata about non-translatable units. Typically, DocBook is used as an intermediate format, which can be processed further using another tool, such as pandoc. These third party tools can use the metadata about non-translatable units to generate sensible HTML output.

如果您使用QDoc为项目生成文档,请注意,您可以选择HTML和DocBook XML作为输出格式。与HTML输出类似,QDoc生成DocBook XML,其中包含有关不可翻译单元的必要元数据。通常,DocBook被用作中间格式,可以使用其他工具(如pandoc)进一步处理。这些第三方工具可以使用关于不可翻译单元的元数据来生成合理的HTML输出。

In the following screenshot, you can see the how "translate=no" attribute affects the translation:

在下面的屏幕截图中,您可以看到“translate=no”属性如何影响翻译:

What's next?

接下来做什么?

The documentation sets on https://doc-snapshots.qt.io/ already use the translate attribute, and we will soon roll out the feature to the sets on https://doc.qt.io/. Try it out and let us know your experience. If you find any issues, do report it by creating a ticket on JIRA.

文档设置为https://doc-snapshots.qt.io/已经使用了translate属性,我们将很快在https://doc.qt.io/.试试看,让我们知道你的经历。如果您发现任何问题,请通过在JIRA上创建问题单来报告。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值