[Koha-bugs] [Bug 8937] Translation process removes CDATA in RSS XML

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Sat Dec 7 11:42:09 CET 2019


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8937

Bernardo Gonzalez Kriegel <bgkriegel at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bgkriegel at gmail.com

--- Comment #7 from Bernardo Gonzalez Kriegel <bgkriegel at gmail.com> ---
(In reply to Victor Grousset/tuxayo from comment #5)
> From what I understand, it turns out that regardless of 15395, the main
> translation system will still process the file and remove the CDATA.
> 
> So I don't know what would be a decent way to fix this.

If one takes a look at the translated file, not all CDATA entries are removed.

In EN 'opac-opensearch.tt' for example there are two lines near the begining,
$ egrep -n CDATA opac-opensearch.tt
25:     <title><![CDATA[.(removed).]]></title>
28:     <description><![CDATA[.(removed).]]></description>

In the translated version of the same file we have
25: <title><![CDATA[[.(removed).]]></title>
28: <description>.(removed).</description>

CDATA is removed but in 'description', not in 'title'!

Why one and not the other? Because of C4::TTParser, based on HTML::Parser.
treats some tags differently (script, style, xmp, iframe, title, textarea and
plaintext), see https://metacpan.org/pod/HTML::Parser

Anyway, the important thing is that ANY text inside CDATA block is IGNORED by
the translation process, whichever the tag, and I was not aware of this.

To verify this: 
go to misc/translator, edit a new file 'test.tt' and put inside the lines

<title><![CDATA[ Title ]]></title>
<description><![CDATA[ Description ]]></description>

then create a translation file form it

./tmpl_process3.pl create -i ./ -f test.tt -s test.po

'test.po' will have nothing to translate!

Change the contents of 'test.po' to

<title> Title </title>
<description> Description </description>

and repeat,

rm test.po; ./tmpl_process3.pl create -i ./ -f test.tt -s test.po

'test.po' has now strings to translate.

Other rss files, 'opac-news-rss.tt' for example, do not use CDATA at all.

Question: Can we remove CDATA blocks from this files? 

It's the only 'fix' that I can think of.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list