Bug 1097091

Summary: "\n" isn't escaped properly for translation in screen elements
Product: [Community] Publican Reporter: Lee Newson <lnewson>
Component: publicanAssignee: Jeff Fearn 🐞 <jfearn>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Lopes <mlopes>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.1CC: aigao, ddomingo, lnewson, rlandman, slong
Target Milestone: 4.2   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 4.2.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-01 03:40:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Simple example to reproduce the issue none

Description Lee Newson 2014-05-13 06:57:41 UTC
Created attachment 895017 [details]
Simple example to reproduce the issue

If the XML contains an element such as:

<screen>
#!/usr/bin/python
import os
import sys
if os.environ.has_key('key1'):
sys.stderr.write('key1 value was : %s\n' % os.environ['key1'])
else:
sys.exit(0)
</screen>

then the "\n" text isn't escaped to "\\n" and the msgid in the pot file is:

msgid "\n"
"#!/usr/bin/python\n"
"\n"
"import os\n"
"import sys\n"
"\n"
"if os.environ.has_key('key1'):\n"
"	sys.stderr.write('key1 value was : %s\n"
"' % os.environ['key1'])\n"
"else:\n"
"    sys.exit(0)\n"
""

This means that the string will likely be translated incorrectly such that the "\n" text will actually be a new line.

Comment 3 Summer Long 2014-08-26 00:25:28 UTC
This is now in the .pot file:
msgid ""
"\n"
"#!/usr/bin/python\n"
"FINDME\n"
"import os\n"
"import sys\n"
"if os.environ.has_key('key1'):\n"
"sys.stderr.write('key1 value was : %s\\n' % os.environ['key1'])\n"
"else:\n"
"sys.exit(0)"
msgstr ""

So %s\\n looks good, but because I'm not familiar with .pot files, Lee can you confirm that the changed 
msgid ""
"\n"

from 
msgid "\n"
is ok?

Comment 4 Lee Newson 2014-08-26 00:32:49 UTC
Without the xml source I can't say for sure, but it looks fine (the reason is the white space is gone and there is the "FINDME" text now).

Comment 5 Don Domingo 2014-08-26 00:34:02 UTC
Setting to VERIFIED.

Comment 6 Lee Newson 2014-08-26 00:38:53 UTC
And oops to fully answer Summer's question, the difference in the first line of the msgid is fine.

Comment 7 Jeff Fearn 🐞 2014-08-26 06:03:43 UTC
Hi, the show/hide tags where removed by the designer for UX reasons.

Comment 8 Jeff Fearn 🐞 2014-08-26 06:04:55 UTC
(In reply to Jeff Fearn from comment #7)
> Hi, the show/hide tags where removed by the designer for UX reasons.

Error 13: Idiot at keyboard.

wrong bug!

Comment 9 Jeff Fearn 🐞 2014-09-01 03:40:30 UTC
A fix for this shipped in Publican 4.2.0.