From ed09f209a0b7a230838b809faa5ee2f587baee28 Mon Sep 17 00:00:00 2001 From: Hammat Wele Date: Fri, 6 Mar 2026 13:21:02 +0000 Subject: [PATCH] Bug 8937: Translation process removes CDATA in RSS XML During template translation, CDATA sections in RSS templates are not handled consistently. When parsing RSS content containing Template Toolkit directives inside CDATA blocks, the CDATA markers () are only preserved only for the tag. To reproduce 1. Install the other language (i used fr-CA here) 1.1. gulp po:update fr-CA 1.2. /misc/translator/translate install fr-CA 2. open and compare files that contain <!CDATA in description example: ./koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt ./koha-tmpl/opac-tmpl/bootstrap/fr-CA/modules/opac-opensearch.tt 3. In the fr-CA file the description tag ==> the <!CDATA is removed 3. Apply the patch 4. Repeat step 1.2, 2 and 3 ==> the <!CDATA is not removed --- C4/TTParser.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/C4/TTParser.pm b/C4/TTParser.pm index f1556206a56..00f32dca1a8 100644 --- a/C4/TTParser.pm +++ b/C4/TTParser.pm @@ -79,6 +79,10 @@ sub text { my $work = shift; # original text my $is_cdata = shift; + if ($is_cdata) { + $work = "<![CDATA[$work]]>"; + } + # If there is a split template toolkit tag if ( $work =~ m/^(?:(?!\[%).)*?%\]/s ) { my @strings = ($&); -- 2.34.1