Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug New lines in XLIFF exports

Discussion in 'Localization Tools' started by zdolezal, Mar 2, 2021.

  1. zdolezal

    zdolezal

    Joined:
    Sep 27, 2017
    Posts:
    75
    I think the exported entries in XLIFF should contain:

    xml:space="preserve"


    Otherwise the new lines are deleted upon working with the XLIFF.
     
    karl_jones likes this.
  2. zdolezal

    zdolezal

    Joined:
    Sep 27, 2017
    Posts:
    75
    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
    upload_2021-3-2_12-14-44.png
     
  3. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,226
    Awesome. Can you share some steps I can do to reproduce the original problem so I can make sure its fixed?
     
  4. zdolezal

    zdolezal

    Joined:
    Sep 27, 2017
    Posts:
    75
    Yeah,

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

    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.
     
  5. zdolezal

    zdolezal

    Joined:
    Sep 27, 2017
    Posts:
    75
    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'

    upload_2021-3-2_13-37-17.png
    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?

    upload_2021-3-2_13-59-42.png

    Is that OK?
     
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,226
    Last edited: May 12, 2021
  7. zdolezal

    zdolezal

    Joined:
    Sep 27, 2017
    Posts:
    75
  8. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,226
  9. zdolezal

    zdolezal

    Joined:
    Sep 27, 2017
    Posts:
    75
    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!
     
    karl_jones likes this.