使用 QT Utilities (lconvert) 将翻译文件 (.ts) 与现有的 .ts 文件合并 [英] Merge translation files (.ts) with existing .ts files using QT Utilities (lconvert)

查看:100
本文介绍了使用 QT Utilities (lconvert) 将翻译文件 (.ts) 与现有的 .ts 文件合并的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的问题:我们的产品有九种不同语言的 .ts 文件.我们添加了大约 100 个需要翻译的新字符串,但有些用于我们的下一个版本,有些用于之后的版本.我们遇到了翻译人员丢失字符串或提前翻译字符串的问题.我们希望能够向他们发送仅包含我们现在要翻译的字符串的较小 .ts 文件,然后将该 .ts 文件合并到包含其余翻译内容的较大 .ts 文件中.

Here's my problem: We've got .ts files for nine different languages for our product. We've added about 100 new strings that need to be translated, but some are for our next release, and some are for the release after that. We've run into problems with translators missing strings or translating strings ahead of time. We want to be able to send them smaller .ts file containing only the strings we want translated now, and then merge that .ts file into the larger .ts file containing the rest of the translation.

我们的翻译人员必须使用 QT Linguist(以前我们让他们编辑原始 XML,但结果并不理想).

Our translators are required to use QT Linguist (previously we let them edit the raw XML with less than stellar results).

一种解决方案是使用上下文,但我们的开发团队并不是很热衷于这个想法.另一种方法是手动合并 .ts 文件,但这似乎是 cut & 的秘诀.粘贴错误.

One solution would be to use contexts, but our dev team is not very keen on that idea. Another would be to merge the .ts files by hand, but that seems like a recipe for cut & paste errors.

有没有lupdate&的方法添加或合并辅助 .ts 文件的项目文件?我已经通读了 QT-land 中的论坛,没有找到答案,但是 lupdate 中的开关暗示能够指向其他翻译文件.特别是 -pro 开关,它说:

Is there a method with lupdate & the project file to add or merge secondary .ts files? I've read through the forums in QT-land w/o finding the answer, but the switches in lupdate allude to being able to point to other translation files. Specifically the -pro switch which says:

    -pro <filename>
       Name of a .pro file. Useful for files with .pro file syntax but
       different file suffix. Projects are recursed into and merged.

示例 1:我们有一个德语 .ts 文件,我们希望从单独的德语翻译文件中添加 20 个字符串,以便主翻译文件包含所有字符串,包括 20 个新字符串.

Example1: we have a German .ts file, we want to add 20 strings from a separate German translation file such that the primary translation file contains all the strings including the 20 new ones.

示例 2:我们有一个德语 .ts 文件,我们希望从单独的德语翻译文件中添加 20 个字符串,以便在 lupdate 期间将辅助翻译文件与主要翻译文件合并,以便生成的 .qm 文件包含所有字符串包括 20 个新的.

Example2: we have a German .ts file, we want to add 20 strings from a separate German translation file such that the secondary translation file will be merged with the primary during lupdate so that the resultant .qm file contains all the strings including the 20 new ones.

有没有人做过其中任何一个(并且任何一个都可以),你能给我一些见解吗?

Has anyone done either of these (and either would work) and can you give me some insight?

推荐答案

答案不使用 lupdate,它位于另一个名为 lconvert 的实用程序中.创建一个仅包含您感兴趣的字符串的辅助文件(并从主文件中删除那些相同的字符串)非常容易,然后运行:

The answer doesn't use lupdate, it lies in another utility called lconvert. It's quite easy to create a secondary file that only contains the strings you're interested in (and delete those same strings from the primary file), then run:

lconvert -i primary.ts secondary.ts -o complete.ts

这将从两个输入文件中取出所有字符串并将它们一起放入输出文件中.使用这种方法,我能够创建原始文件的零差异文件(时间戳除外),我将其拆分为两个主要文件.辅助文件来自.

This will take all the strings from the two input files and put them together into the output file. Using this method I was able to create a zero difference file (other than time stamp) of the original file that I'd split the two primary & secondary files from.

这个问题没有得到太多关注,但也许有人会遇到同样的问题,这会有所帮助.

This question didn't get a lot of attention, but maybe someone will have this same problem and this will help.

这篇关于使用 QT Utilities (lconvert) 将翻译文件 (.ts) 与现有的 .ts 文件合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆