如何从同一 XLIFF 翻译文件生成 .resx 和 .properties 文件

发布于 2024-12-21 08:35:13 字数 556 浏览 3 评论 0原文

为了最大限度地减少本地化工作,我希望能够在公司内的所有项目中重复使用相同的翻译。问题是项目是用不同的语言开发的,特别是C#Java

正如我在此处描述的,我为xliff 提取和合并是 Okapi Rainbow - 但到目前为止,该工具似乎只能将 xliff 翻译后处理为提取 xliff 的原始格式。因此,如果 xliff 是从 resx 中提取的 - 似乎没有明显的方法来获取 Java .properties 作为输出。

我错过了一个简单的步骤吗?如果我根本没有原始文件 - 有没有办法直接从 xliff 生成 resx/properties 文件?

In order to minimize the localization efforts I would like to be able to re-use the same translations for all the projects within the company. The problem is that projects are developed in different languages, to be particular C# and Java.

As I described here the handy tool I found for xliff extraction and merging is Okapi Rainbow - but so far it looks that this tool can post-process xliff translation only into original format the xliff was extracted from. So if xliff was extracted from resx - there seems to be no obvious way to get Java .properties as output.

Am I missing a simple step? If I don't have the original file at all - is there a way to generate resx/properties files directly from xliff?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一曲爱恨情仇 2024-12-28 08:35:13

Okapi 需要原始文件才能从 XLIFF 生成目标文件。

其中之一是因为 XLIFF 仅从文件中提取可本地化的部分。如果您查看 resx 文件,会发现和 <重新标题>不要被提取。因此,没有办法在没有“骨架”的情况下生成 resx 文件

。另外,我不会通过 XLIFF 在属性和 resx 之间进行映射。除此之外,您可能也想对英语这样做。

直接在 .properties 和 resx 之间进行转换应该是相对容易的。
例如 resgen foo.resx foo.txt 会将 foo.resx 转换为 foo.txt,这非常像 Java 属性文件,只不过它是 UTF-8 (所以你可以只使用 native2ascii )。

或者您可以编写自己的简单转换器(使用 ResXResourceReader 和 ResXResourceReader)。

Okapi needs the original file to generate the target file from XLIFF.

Among others because the XLIFF extract only the localizable part from a file. If you look at a resx file, the <xsd:schema> and <resheader> don't get extracted. So there is no way to generate back a resx file without a "skeleton"

Also, I would not go thru XLIFF to map between properties and resx. Among other you might want to do that for English too.

It should be relatively easy thought to convert between .properties and resx directly.
For instance resgen foo.resx foo.txt will convert foo.resx to foo.txt, which is very much like a Java properties file, except that is is UTF-8 (so you can just use native2ascii).

Or you can write your own simple convertor (using ResXResourceReader and ResXResourceReader).

苏大泽ㄣ 2024-12-28 08:35:13

您不需要将 .resx 文件转换为 .property 文件,反之亦然,因为翻译人员使用的 CAT 工具将以中间格式(例如 tmx)存储句子以匹配源句子。

You do not need to convert the .resx files into .property files or vice versa as the CAT tool your translators use will store the sentences in an intermediate format, e.g. tmx to match the source sentences.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文