Hi,

I have problem with bug 6458 
(http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6458).

I will resume the problem (as the bug report is "historical commented" and the 
problem not clearly pointed at the beginning):

Currently, the translation parser (use to apply po files) don't support 
template directive *in* tag. 

For example:
 <tagname attr1="value1" templateText attr2="value2" ...>

is interpreted like:
 <tagname attr1="value1" templateText="templateText" attr2="value2" ...>

This occurs rarely in templates, and generate a problem *only* when translation 
replacement occurs *also* in this tag.


Here a case not generating problem (in 'opac-user.tt'):
 <tr[% IF ( overdue ) %] class="overdue"[% END %]>

No problem, because a bad-parsed hash is not used, as the element contains no 
translated string, so the tag isn't rewrited [see 'tmpl_process3.pl': function 
'text_replace_tag', rewrite occurs only if $translated_p]).



Here a case with problem (in 'sco/sco-main.tt'):
 <input type="button" value="Renew Item" [% UNLESS ( renew ) %] 
name="confirm"[% END %] class="renew" 
onclick="this.form.confirmed.value='1';this.form.submit();" />

TTParser read as:
 tagname=input
 attributes = {
   type = "button",
   value = "Renew Item",
   [% = "[%",
   unless = "UNLESS",
   %] = "%]",
   ...
 }

And as the value attribute is a translated string, this bad-parsed hash is used 
to rewrite the tag, resulting:
 <input value="Renouveler document" name="confirm" unless="UNLESS" %]="%]" 
renew="renew" end="END" )=")" type="button" 
onclick="this.form.confirmed.value='1';this.form.submit();" class="renew" (="(" 
[%="[%" />

which is not a valid template... and TT produce a blocking error.



So what to do ?
 1. works on TTParser.pm, in order to include case for DIRECTIVE in tag element 
? (lot of work for rare occurences)
 2. works 'tmpl_process3.pl' for change the rewriting style of element (not 
using the parsed hash, using regexp for example) ? (not a strong method, and 
need some works too)
 3. discard the use of Template DIRECTIVE in tag element ? (adding a test case 
for report incorrect use of template *in* tag element, or a check in TTParser 
reporting "unallowed template form")
 4. discard the use of Template DIRECTIVE in tag element which contains 
translated string ? (same before, but more complex to implement)

Personnally, I prefer the 3 (or 4) choice... but what is your opinion about 
this ?

Thanks.
-- 
Frère Sébastien Marie
Abbaye Notre Dame de La Trappe
61380 Soligny-la-Trappe
Tél: 02.33.84.17.00
Fax: 02.33.34.98.57
Web: http://www.latrappe.fr/
_______________________________________________
Koha-devel mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to