简体   繁体   English

Xcode 6.1.1导入本地化错误“缺少XLIFF id属性”

[英]Xcode 6.1.1 import localisations error “XLIFF id attribute missing”

I recently exported XLIFF files using Xcode's Export for localisation tool. 我最近使用Xcode的本地化导出工具导出了XLIFF文件。 The files were translated and I then tried to import them but I keep getting the error "XLIFF id attribute missing". 文件已翻译,然后我尝试导入它们,但我不断收到错误消息“缺少XLIFF id属性”。 I thought maybe one of the translators messed up the file so as a test I re-exported the XLIFF file and tried to import them without making any changes to them and still got the error "XLIFF id attribute missing". 我以为可能是一位翻译弄乱了文件,所以作为测试,我重新导出了XLIFF文件,并尝试在不对其进行任何更改的情况下将其导入,仍然出现错误“ XLIFF id属性丢失”。

Any ideas whats going on here? 有什么想法吗?

For me, this was related to this question: Xcode 6 localization. 对我来说,这与以下问题有关: Xcode 6本地化。 export .xliff file will cut the string when the string is like “this is sample \\”text\\“” 当字符串类似于“ this is sample \\” text \\””时,export .xliff文件将剪切字符串。

My string file looked like this: 我的字符串文件如下所示:

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

Exported in the XLIFF, it looked like this: 在XLIFF中导出,如下所示:

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

My translators faithfully translated it: (simulated) 我的翻译们如实翻译:(模拟)

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

Upon attempting to import the translated XLIFF, I received the XLIFF id attribute missing error. 尝试导入已翻译的XLIFF时,我收到XLIFF id attribute missing错误。

To fix this, I went into my strings file and changed the entry to this: 为了解决这个问题,我进入了我的字符串文件,并将条目更改为此:

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

and the xliff... 和xliff ...

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

...and then imported, and it worked. ...然后导入,就可以了。 Obviously at this point the translation for that one string is wrong and needs to be redone, but at least the rest of the text imported. 显然,在这一点上,该字符串的翻译是错误的,需要重做,但至少要导入其余的文本。


Edit: 编辑:

I've been looking for a solution to this. 我一直在寻找解决方案。 I found that using curly quotes does export correctly, so the string: some english “text” produces the xliff: 我发现使用弯引号确实可以正确导出,因此字符串: some english “text”会生成xliff:

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

That's the only way I know of to do this, currently. 目前,这是我所知道的唯一方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM