Bug 34310: Input prompt in datatables column search boxes untranslatable

This patch corrects the internationalization function wrapped around the
"% search" string in datatables.js. It should be the double-underscore
function instead of the single-underscore.

To test, apply the patch and test that the placeholder string is
translatable. In this example I'm testing fr-FR:

- Update a translation:

  > cd misc/translator
  > perl translate update fr-FR

- Open the corresponding .po file for the strings pulled from
  JavaScript  e.g.  misc/translator/po/fr-FR-messages-js.po
  - Locate strings pulled from prog/js/datatables.js for
    translation, e.g.:

    \#: koha-tmpl/intranet-tmpl/prog/js/datatables.js:894
    \#, javascript-format
    msgid "%s search"
    msgstr "%s recherche"

  - Install the updated translation:

    > perl translate install fr-FR

In the staff interface, test a page that has column header filters, e.g.
patron search. Confirm that the table of search results shows the
translated string in the column header placeholders.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Owen Leonard 2023-07-20 11:24:23 +00:00 committed by Tomas Cohen Arazi
parent 8f7d565df5
commit c23f36b812
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -896,7 +896,7 @@ function _dt_add_filters(table_node, table_dt, filters_options = {}) {
if ( existing_search ) {
$(this).html( '<input type="text" value="%s" style="width: 100%" />'.format(existing_search) );
} else {
var search_title = _("%s search").format(title);
var search_title = __("%s search").format(title);
$(this).html( '<input type="text" placeholder="%s" style="width: 100%" />'.format(search_title) );
}
}