Export XLIFF fails on comments inside NSLocalizedString calls

Originator:kevin
Number:rdar://42171670 Date Originated:July 13 2018
Status:Open Resolved:
Product:Developer Tools Product Version:
Classification:Other Bug Reproducible:Always
 
Summary:
If I have Swift code with a call to NSLocalizedString, and I have a comment in between the arguments to the call, `genstrings` handles this just fine but Xcode's new Export Localization feature throws an error and omits this localized string from the results.

I've attached a project that demonstrates this. The offending NSLocalizedString call looks like

        _ = NSLocalizedString("This is a value",
                              // Here is a comment
            comment: "Here is the localized string comment")

Steps to Reproduce:
1. Run `genstrings` on this project.
2. Run `xcodebuild -exportLocalizations` on this project.

Expected Results:
Both the genstrings output and the exported XLIFF should include the localized string.

Actual Results:
The genstrings output includes the localized string but the XLIFF output doesn't, and the xcodebuild call prints an error incorrectly claiming "Argument is not a literal string".

I've attached the genstrings output as well as the Xcode 9.4 XLIFF output.

Version/Build:
Xcode 9.4.1 (9F2000)
Xcode 10.0 (10L201y)

Notes:
I haven't tested Obj-C here, just Swift.

Comments


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!