I recently exported XLIFF files using Xcode's Export for localisation tool. The files were translated and I then tried to import them but I keep getting the error "XLIFF id attribute missing". 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".
Any ideas whats going on here?
For me, this was related to this question: Xcode 6 localization. export .xliff file will cut the string when the string is like “this is sample \”text\“”
My string file looked like this:
"some english \"text\"" = "some english \"text\""
Exported in the XLIFF, it looked like this:
<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.
To fix this, I went into my strings file and changed the entry to this:
"some english 'text'" = "some english 'text'"
and the 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:
<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.