Testing the new item search from available from the advanced search page in the staff client I found it only working in English, but not in its German translation. This is a 3.18.3 installation with current templates. The Javascript errors shown in Firebug are very unspecific - I haven't been able yet to find the source of the problem. Any help much appreciated.
I see this problem too. I checked out 3.18.3, installed and switched to the German templates, and tried the item search. The search results table never renders. I don't see any errors in the Firebug console, but looking at the data being sent to DataTables I see some differences in the English versus the German output. English: [ "<a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=5515' title='Go to record detail page'>Endless ocean</a> by ", "", "Nintendo of America,", "", "<a href='/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=5515#item11264' title='Go to item details'>33000000094272</a>", "Wii Endless", "The Plains", "The Plains", "", "", "", "0", "<a href='/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=5515&itemnumber=11264'>Edit</a>" ] German: [ "<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=5515" title="Zur Detailansicht">Endless ocean</a> von ", "", "Nintendo of America,", "", "<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=5515#item11264" title="Zurück zu den Exemplardetails">33000000094272</a>", "Wii Endless", "The Plains", "The Plains", "", "", "", "0", "<a href='/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=5515&itemnumber=11264'>Bearbeiten</a>" ] In the German version the quotes around HTML attributes are double quotes instead of the single quotes seen in the English version. I assume that is what is breaking things.
Thx Owen for taking the time to look at this! I fixed a few problems with the strings, but it still doesn't work. And the problem with the quotes does not seem to exist in the po file? I went through all strings for this template, but had no luck finding anything that would explain it.
I think this appears to be a problem with the translation script. It appears other translations that I tested this with are not complete - only in the German version of the file some things appear as translated, but not in fr-FR, nb-NO etc.
The problem also exists in the more complete es-ES translation.
I think there is two different ways to fix this: 1/ Fix tmpl_process3.pl to put the same quotes (single or double) as in the original file 2/ exclude includes/catalogue/itemsearch_item.json.inc from the list of files to translate (by changing its extension ?) and use Koha::I18N for translatable text in this file My preferences goes to 2. What do you think ?
Template parsing is done by HTML::Parser and I can't find in the doc how to know if attributes values were specified with single or double quotes. So maybe (1) is not even a solution.
Hm, What about 3)? Could we rewrite the file in a way, that will avoid the multiple quotes? Like building the string separately and then using a variable?
I think changing the file ending would work - I have used this trick to avoid auto-translations in some other place in the past. But not a 'nice' solution.
(2) will fail anyway, in case the translated string contains single quotes ... :/
Created attachment 35897 [details] [review] Bug 13700: Fix item search templates for translation Since translator rebuild HTML tags with double quotes for attributes values, use double quotes in english template too and escape them with backslash.
Yay! Thx Julian!
Created attachment 35899 [details] [review] [SIGNED-OFF] Bug 13700: Fix item search templates for translation Since translator rebuild HTML tags with double quotes for attributes values, use double quotes in english template too and escape them with backslash. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> It works well!! Test: 1) Intall translation (de-DE, es-ES) 2) to Go to item search, in english, do a search that gives results 3) Switch language, repeat search, result's table does not render 4) Apply patch 5) Install translation again 6) Repeat 3, now results are displayed No koha-qa errors
Created attachment 35907 [details] [review] [PASSED QA] Bug 13700: Fix item search templates for translation Since translator rebuild HTML tags with double quotes for attributes values, use double quotes in english template too and escape them with backslash. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> It works well!! Test: 1) Intall translation (de-DE, es-ES) 2) to Go to item search, in english, do a search that gives results 3) Switch language, repeat search, result's table does not render 4) Apply patch 5) Install translation again 6) Repeat 3, now results are displayed No koha-qa errors Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Patch pushed to master. Thanks Julian!
String changes, held for 3.18.5
Pushed to 3.18.x will be in 3.18.5