Xcode 9 Import Localizations corrupts strings files

Originator:srossillo
Number:rdar://41216410 Date Originated:2018-06-18
Status:Open Resolved:
Product:Xcodede Product Version:9.4.1 (9F2000)
Classification:Bug Reproducible:Always
 
Summary:
Importing XLIFF localizations when the target contains isolated tags (<it></it>) causes the target strings file to become corrupt. The XML representation of the target is saved to a strings file.

This is a regression from Xcode 8.x, which would import the string correctly.

Steps to Reproduce:
1. Open attached project in Xcode 9.x.
2. Editor > Import Localizations
3. Choose localization/es.xilff file from the chooser
4. Open Main.strings (Spanish)
5. Note strings file contains XML state dump rather than the expected string


Expected Results:
Main.strings (target language contains):
"i0Y-Jy-l5w.text" = "<html><body>hola";

Actual Results:
i0Y-Jy-l5w.text" = "{
    children =     (
                {
            attributes =             (
                                {
                    content = 3;
                    name = pos;
                    type = attribute;
                }
            );
            children =             (
                                {
                    content = "<html>";
                    name = text;
                    type = text;
                }
            );
            href = "urn:oasis:names:tc:xliff:document:1.2";
            name = it;
            prefix = "";
            type = element;
        },
                {
            attributes =             (
                                {
                    content = 6;
                    name = pos;
                    type = attribute;
                }
            );
            children =             (
                                {
                    content = "<body>";
                    name = text;
                    type = text;
                }
            );
            href = "urn:oasis:names:tc:xliff:document:1.2";
            name = it;
            prefix = "";
            type = element;
        },
                {
            content = hola;
            name = text;
            type = text;
        }
    );
    href = "urn:oasis:names:tc:xliff:document:1.2";
    name = target;
    prefix = "";
    type = element;
}";


Version/Build:
Version 9.4.1 (9F2000)

Configuration:
standard

A project with XLIFF to reproduce the problem can be found here or see attached.
https://github.com/foo4u/apple-code-xliff-bug

Comments

This is a regression from Xcode 8.3.3.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!