Summary: | Translation process removes CDATA in RSS XML | ||
---|---|---|---|
Product: | Koha | Reporter: | Fridolin Somers <fridolin.somers> |
Component: | I18N/L10N | Assignee: | Bugs List <koha-bugs> |
Status: | NEW --- | QA Contact: | |
Severity: | normal | ||
Priority: | P5 - low | CC: | bgkriegel, f.demians, marjorie.barry-vila, victor |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: |
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8936 https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20286 |
||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | --- | Documentation contact: | |
Documentation submission: | Text to go in the release notes: | ||
Version(s) released in: | Circulation function: | ||
Attachments: | Bug 8937: Translation process removes xml prolog |
Description
Fridolin Somers
2012-10-17 09:06:19 UTC
I notice the fr-FR version of opac-opensearch.tt is also missing the XML declaration at the top ("<?xml version='1.0' encoding='utf-8' ?>"). == Reproduice == 1. opac: switch to english language 2. opac: Search for something that returns multiple results 3. open rss feed 4. See that the author name and "place hold" link show Optional: Right click → page source → see that multiple CDATA section are there 5. Translate & switch to another language than english 6. open rss feed 7. See that only the titles show. Nor the author name nor the "place hold" link This is the bug. Optional: Right click → page source → see that only one CDATA section is there Should be fixed by bug 15395 So it might be better to put the efforts in treating the cause instead of yet another symptom. (In reply to Victor Grousset/tuxayo from comment #3) > Should be fixed by bug 15395 > > So it might be better to put the efforts in treating the cause instead of > yet another symptom. Bug 15395 is pushed now. Would you be able to provide a fix here? 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. Created attachment 96076 [details] [review] Bug 8937: Translation process removes xml prolog This patch fix the missing xml prolog in translated files, xml ot TT. Is fixed teaching C4::TTParse not to ignore <?..?> constructs, then teaching xgettext.pl to ignore those strings. Net result is that they are copied in the translated file. To test: 1) Update & install your preferred language, (cd misc/translator/; perl translate update xx-YY; perl translate install xx-YY ) 2) Compare the first lines (head -2) of: koha-tmpl/opac-tmpl/bootstrap/en/xslt/compact.xsl koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt koha-tmpl/intranet-tmpl/prog/en/xslt/plainMARC.xsl and koha-tmpl/opac-tmpl/bootstrap/xx-YY/xslt/compact.xsl koha-tmpl/opac-tmpl/bootstrap/xx-YY/modules/opac-opensearch.tt koha-tmpl/intranet-tmpl/prog/xx-YY/xslt/plainMARC.xsl Check the missing prolog 3) Install this patch, repeat 1 and 2, now the prolog is present on translated files. (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. >
> Change the contents of 'test.po' to
>
It's 'test.tt', sorry.
Comment on attachment 96076 [details] [review] Bug 8937: Translation process removes xml prolog Patch moved to Bug 25257 I guess this patch can be closed right? *** This bug has been marked as a duplicate of bug 25257 *** (In reply to Victor Grousset/tuxayo from comment #10) > I guess this patch can be closed right? > > *** This bug has been marked as a duplicate of bug 25257 *** Well, that CDATA is removed is still valid. What I said previously is that our current translation process ignores text inside CDATA, but there is Bug 25067, when it gets in I'll revisit this one. Then, I think that this is not a duplicate of 25257. I wrote that patch following the comment #1 on this bug, but is not a solution to the reported problem, then I never switched this to 'NS'. I open another bug and moved my patch there as a way to make it pass, it solves other little problem. Please leave this open. > I wrote that patch following the comment #1 on this bug, but is not a solution to the reported problem, then I never switched this to 'NS'.
Thanks for the clarification, indeed it's not the same thing.
|