Bug 1097091 - "\n" isn't escaped properly for translation in screen elements
Summary: "\n" isn't escaped properly for translation in screen elements
Alias: None
Product: Publican
Classification: Community
Component: publican
Version: 4.1
Hardware: Unspecified
OS: Unspecified
Target Milestone: 4.2
Assignee: Jeff Fearn 🐞
QA Contact: Martin Lopes
Depends On:
TreeView+ depends on / blocked
Reported: 2014-05-13 06:57 UTC by Lee Newson
Modified: 2014-09-01 03:40 UTC (History)
5 users (show)

Fixed In Version: 4.2.0
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2014-09-01 03:40:30 UTC

Attachments (Terms of Use)
Simple example to reproduce the issue (7.78 KB, application/zip)
2014-05-13 06:57 UTC, Lee Newson
no flags Details

System ID Private Priority Status Summary Last Updated
CPAN 96016 0 None None None Never

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:

import os
import sys
if os.environ.has_key('key1'):
sys.stderr.write('key1 value was : %s\n' % os.environ['key1'])

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

msgid "\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"
"    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 ""
"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"
msgstr ""

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

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.

Note You need to log in before you can comment on or make changes to this bug.