This bug affects (at least) master and 3.20.x. To reproduce: - On the staff interface create a private list - Go to More > Lists ('Your lists' tab) => SUCCESS: Your private list is shown. - Translate the templates to any language like: $ cd misc/translator/ $ perl translate install es-ES - Enable the translated templates on the sysprefs - Switch to the translated language - Go to the lists page (Mas > Listas in es-ES) => FAIL: The datatable hangs waiting for the svc/shelves script to return data
Created attachment 40904 [details] Sample broken lists (es-ES)
Created attachment 40905 [details] Sample working lists (en)
Created attachment 40994 [details] [review] Bug 14517: List shelves list is broken for translated interfaces The translation script adds quotes ("") around translated string (Edit for instance). Which breaks the json structure. Example: "dt_action": "<a style=\"cursor:pointer\"><form action='shelves.pl' method='get'><input class="editshelf" value="Editar" type="submit" /></form></a>" Test plan: 1/ On the staff interface create a private list 2/ Go to More > Lists ('Your lists' tab) 3/ Translate the templates to any language like: $ cd misc/translator/ $ perl translate install es-ES 4/ Enable the translated templates on the sysprefs 5/ Switch to the translated language 6/ Go to the lists page (Mas > Listas in es-ES) The list should be displayed correctly. Note: There is a limitation. If a translated string contains a simple quote ('), it will also break the json.
Comment on attachment 40994 [details] [review] Bug 14517: List shelves list is broken for translated interfaces Review of attachment 40994 [details] [review]: ----------------------------------------------------------------- I fear trying to understand how this works at this late hour. ::: koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt @@ +29,4 @@ > } > > [% BLOCK action_form -%] > +[%~ SET action_block = '' ~%] http://template-toolkit.org/docs/manual/Config.html#section_PRE_CHOMP_POST_CHOMP "To remove all whitespace including any number of newlines, use the '~' character instead. [% FOREACH user IN userlist %] [%~ user ~%] [% END %]" --- learned something new. Though this was hard to find in the manual. @@ +32,5 @@ > +[%~ SET action_block = '' ~%] > +[%~ IF can_manage_shelf OR can_delete_shelf ~%] > + [%~ IF can_manage_shelf ~%] > + [%~ action_block = '<form action="shelves.pl" method="get">' ~%] > + [%~ action_block = action_block _ '<input type="hidden" name="shelfnumber" value="' _ shelfnumber _ '" />' ~%] http://www.template-toolkit.org/docs/manual/Directives.html#section_SET "You can concatenate strings together using the ' _ ' operator."
Can I get a rebase please Applying: Bug 14517: List shelves list is broken for translated interfaces fatal: sha1 information is lacking or useless (koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt). Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge. Patch failed at 0001 Bug 14517: List shelves list is broken for translated interfaces
Created attachment 41467 [details] [review] Bug 14517: List shelves list is broken for translated interfaces The translation script adds quotes ("") around translated string (Edit for instance). Which breaks the json structure. Example: "dt_action": "<a style=\"cursor:pointer\"><form action='shelves.pl' method='get'><input class="editshelf" value="Editar" type="submit" /></form></a>" Test plan: 1/ On the staff interface create a private list 2/ Go to More > Lists ('Your lists' tab) 3/ Translate the templates to any language like: $ cd misc/translator/ $ perl translate install es-ES 4/ Enable the translated templates on the sysprefs 5/ Switch to the translated language 6/ Go to the lists page (Mas > Listas in es-ES) The list should be displayed correctly. Note: There is a limitation. If a translated string contains a simple quote ('), it will also break the json. Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
I just noticed that our To plugin, we just use to do JSON .. In future we could maybe use this? But this is a just a comment. No reason to hold the bug http://search.cpan.org/~nuffin/Template-Plugin-JSON-0.06/lib/Template/Plugin/JSON.pm
(In reply to Chris Cormack from comment #7) > I just noticed that our To plugin, we just use to do JSON .. In future we > could maybe use this? But this is a just a comment. No reason to hold the bug > > http://search.cpan.org/~nuffin/Template-Plugin-JSON-0.06/lib/Template/Plugin/ > JSON.pm The idea was to avoid another dependency.
Created attachment 41624 [details] [review] [PASSED QA] Bug 14517: List shelves list is broken for translated interfaces The translation script adds quotes ("") around translated string (Edit for instance). Which breaks the json structure. Example: "dt_action": "<a style=\"cursor:pointer\"><form action='shelves.pl' method='get'><input class="editshelf" value="Editar" type="submit" /></form></a>" Test plan: 1/ On the staff interface create a private list 2/ Go to More > Lists ('Your lists' tab) 3/ Translate the templates to any language like: $ cd misc/translator/ $ perl translate install es-ES 4/ Enable the translated templates on the sysprefs 5/ Switch to the translated language 6/ Go to the lists page (Mas > Listas in es-ES) The list should be displayed correctly. Note: There is a limitation. If a translated string contains a simple quote ('), it will also break the json. Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Patches pushed to master. Great job Jonathan!
Even though this makes template changes, it stops the templates breaking completely so pushing Will be in 3.20.3