Xcode 6.1.1 导入位置错误"XLIFF id attribute missing"

Xcode 6.1.1 import localisations error "XLIFF id attribute missing"

我最近使用 Xcode 的本地化导出工具导出了 XLIFF 文件。文件已翻译,然后我尝试导入它们,但我一直收到错误 "XLIFF id attribute missing"。我认为可能是其中一位翻译人员弄乱了文件,因此作为测试,我重新导出了 XLIFF 文件并尝试在不对它们进行任何更改的情况下导入它们,但仍然出现错误 "XLIFF id attribute missing".

有什么想法吗?

对我来说,这与这个问题有关:Xcode 6 localization. export .xliff file will cut the string when the string is like “this is sample \”text\“”

我的字符串文件如下所示:

"some english \"text\"" = "some english \"text\""

在 XLIFF 中导出,看起来像这样:

<trans-unit id="">
    <target>some english \</target>
    <source>some english \</target>
    <note></note>
</trans-unit>

我的翻译人员忠实地翻译了它:(模拟)

<trans-unit id="">
    <target>some english \</target>
    <source>xyz abcdefg \</source>
    <note></note>
</trans-unit>

在尝试导入翻译后的 XLIFF 时,我收到 XLIFF id attribute missing 错误。

为了解决这个问题,我进入了我的字符串文件并将条目更改为:

"some english 'text'" = "some english 'text'"

和 xliff...

<trans-unit id="some english 'text'">
    <target>some english 'text'</target>
    <source>xyz abcdefg</source>
    <note></note>
</trans-unit>

...然后导入,成功了。显然此时那个字符串的翻译是错误的,需要重做,但至少导入了其余的文本。


编辑:

我一直在寻找解决方法。我发现使用大引号确实可以正确导出,因此字符串:some english “text” 会生成 xliff:

<trans-unit id="some english “text”">
    <source>some english “text”</source>
</trans-unit>

这是我目前知道的唯一方法。