New lines in XLIFF exports

I think the exported entries in XLIFF should contain:

xml:space="preserve"

Otherwise the new lines are deleted upon working with the XLIFF.

I have tested that with Weblate and adding this attribute has fixed my issue. New lines are exported / imported correctly.

I just made a quick and dirty fix in xliff1.2.cs

Awesome. Can you share some steps I can do to reproduce the original problem so I can make sure its fixed?

Yeah,

  1. create localization entry in string table with line breaks:

string```

2. export string table to XLIFF (1.2 or 2.0)
3. check exported file for the line breaks
- if the line breaks are just present (without any conversion to the escaped values), xml:space="preserve" need to be added on the trans-unit tag
- or we need to escape the line breaks in the epxorted file

I am not sure which solution is better.

And I am still not sure whether the import is working well with the new lines as I see some artifacts in the string table internal file after the import:

  1. Some of the line breaks were converted into ‘\n’


2) But some entries were not and contain even more line breaks that in the xliff file. But it looks OK in the Unity … isn’t that strange?

Is that OK?

Thats strange. It may just be that XLIFF and Unity Serializer use different formats.
Could you please file a bug report so we can look into it and make sure the preserve is done correctly?

Edit: I created a bug for the issue Unity Issue Tracker - [Localization] exported XLIFF files are missing xml:space="preserve" element

Sry, I haven’t noticed you have created the bug report.
This one is from me: https://fogbugz.unity3d.com/default.asp?1342014_svk3565destdq3jd

No problem this should help as I was struggling to reproduce the issue.

It’s not the issue in Unity you can observe. It’s just the “XLIFF standard” compliance - either escape new lines or add XML attribute to the export (recommended).
Thank you!