如何合并2个.POT文件(翻译文件) [英] How can I merge 2 .POT files (translation files)

查看:152
本文介绍了如何合并2个.POT文件(翻译文件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下情况:

我要翻译的一种产品,具有两个单独的网站,一个用于管理员,一个用于客户.
代码库是CakePHP.
这两个站点是完全分开的,它们是完整的CakePHP站点.
而且它们都有很多共同的字符串.

One product which I want to translate, that has two separate websites, one for admins, one for customers.
The codebase is CakePHP.
Both sites are completely separate from each other, they are complete CakePHP sites.
And they both have A LOT of strings in common.

因此,我使用CakePHP为每个站点生成.pot文件,但我希望为翻译人员提供一个文件,两个.pot文件中都包含唯一的字符串.

So, with CakePHP I generate the .pot files for each site, but I'd love to give translators ONE file, with the unique strings in both .pot files.

他们会给我一个带有两个站点字符串的.po文件,我将同一文件复制到两个站点,所以我将拥有带有额外字符串的.po文件,这些代码将不会使用,但这不应该是问题.

They'd give me back one .po file with the strings for both sites, and I'll just copy the same file to both sites, so I'll have .po files with extra strings that the code will not use, but that shouldn't be a problem.

所以问题本质上是...如何合并两个.pot文件?

So the question essentially is... How can I merge two .pot files?

  • 我需要获取一个没有重复字符串的新文件.
  • 理想情况下,它将在CakePHP添加的每个字符串之前保留(并在重复的字符串后附加)注释,并指定在何处找到该字符串,但是如果不这样做,那很好,我可以不用它. (有关说明,请参见下面的.pot文件摘录)

您知道让我这样做的任何工具吗?我真的很想避免自己写.

Do you know of any tools that'd let me do this? I'd really like to avoid having to write my own.

这些是我在上面谈论的评论:

These are the comments I'm talking about above:

#: \controllers\accounts_controller.php:118
#: \controllers\customer_documents_controller.php:75
msgid "Parent Customer not specified"
msgstr ""

推荐答案

好,所以执行此操作的工具是msgcat

Ok, so the tool to do this is msgcat

msgcat *.pot > all.pot

如果您使用的是Windows,请安装cygwin,并确保您拥有 gettext包.

If you're on Windows, install cygwin, and make sure you have the gettext-devel package, because msgcat is not in the regular gettext package.

这篇关于如何合并2个.POT文件(翻译文件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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