Created attachment 126924 [details] Original and Lokalized TS File comparison SUMMARY Lokalize changes ' to apostrophe character in source strings of TS files. STEPS TO REPRODUCE 1. open sqlb_pl-original.ts in Lokalize 2. translate one string 3. save as sqlb_pl-lokalized.ts OBSERVED RESULT 8th line of sqlb_pl-lokalized.ts is: <source>Version '%1'</source> EXPECTED RESULT 8th line of sqlb_pl-lokalized.ts should be: <source>Version '%1'</source> just like in sqlb_pl-original.ts ADDITIONAL INFORMATION That halted pull request with translated file here https://github.com/sqlitebrowser/sqlitebrowser/pull/2127
Created attachment 126925 [details] sqlb_pl-original.ts
Created attachment 126926 [details] sqlb_pl-lokalized.ts
Please notice that 1st line of sqlb_pl-original.ts <?xml version="1.0" encoding="utf-8"?> got changed to <?xml version='1.0' encoding='utf-8'?> so Lokalize replaced double with single quotation marks as well. That's marked in first attachment as well.
We could technically argue that it is still correct as ' is not a reserved character in XML in that specific location (only & and < are), but I won't do that. It's actually the behavior of the Qt xml parser, I found a workaround by using CDATA, I will push it this week-end (and it will be optionnal).
Git commit 9e80b8358e401888f4bf179b1a8bd818624e796b by Simon Depiets. Committed on 18/04/2020 at 15:58. Pushed by sdepiets into branch 'master'. TS storage shall not un-escape XML special chars By default the QXmlSimpleReader transforms escaped XML chars into the actual chars (except < and &) Now lokalize will re-escape them back and store them in a CData to prevent Qt from amending the string internally On saving, the XML file is first exported to a string and the CData overhead is replaced. This behavior can be disabled in Editor Settings M +83 -32 src/catalog/ts/tsstorage.cpp M +1 -1 src/catalog/ts/tsstorage.h M +3 -0 src/prefs/lokalize.kcfg M +27 -20 src/prefs/prefs_editor.ui https://commits.kde.org/lokalize/9e80b8358e401888f4bf179b1a8bd818624e796b
Thank you for the fix.