Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liamnichols/3e21bf923ada7fd778af9e3b47d2e6ec to your computer and use it in GitHub Desktop.
Save liamnichols/3e21bf923ada7fd778af9e3b47d2e6ec to your computer and use it in GitHub Desktop.
Exporting localisations does not escape quotation marks and new lines correctly
Summary:
The Xcode Export Localisation tool fails to correctly escape quotation marks and new line sequences when exporting via "Editor -> Export For Localization..." or via the xcodebuild command line tool.
The behaviour changed in Xcode 9.3 and has been broken ever since. I've included the "_SampleExport" folder that shows the results of the export when I run it on my machine. Xcode 9.2 produces the results as expected.
The result of this corrupt export means that many third party translation tools retain the escapes in the translated xliff files but when importing them via the import tool, it will corrupt the .strings files as the escaping is wrong. I have not covered an example of it in this report as I believe it will be fixed once the export issue is fixed however it is still worth noting.
Steps to Reproduce:
1. Download the attached sample project
2. Open the project in Xcode 10 (Beta 2)
3. Click on the project in the Project Navigator
4. Click on "Editor" in the menu bar
5. Click on "Export For Localization..."
6. Export the development language somewhere and open the exported xliff file in a text editor
Expected Results:
- Quotation marks that had been escaped with a backslash in order to comply with the open step plist format are not included inside the source tag of a translation unit.
- New line escapes (\n) that had been added in the .strings file should be converted into an actual new line within the source tag in the translation unit.
Actual Results:
- The backslash escaping the quotation marks still remain in the xliff file.
- The new line escape remains as "\n" in the xliff file
Version/Build:
Version 10.0 beta 2 (10L177m)
Configuration:
N/A
https://openradar.appspot.com/radar?id=4972707506552832
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment