Koha/koha-tmpl/opac-tmpl/bootstrap/en/includes/datatables.inc
Owen Leonard 981b601c39
Bug 25909: Recent change to datatables JS in the OPAC causes errors
This patch reverts some changes made by Bug 25287 which prematurely
introduced the double-underscore i18n function. The i18n features
haven't been fully implemented in the OPAC.

Some lines are reverts to the previous version, and some are additions,
for instance where Bug 25287 introduced new DataTables features and a
new string translation is required.

In addition to i18n changes, the patch also reverts the default
configuration of DataTables in the OPAC so that the "dom" configuration
option is set back to "t." This turns off features like pagination
buttons, filters, etc. which were previously disabled by default.

Enabling these features requires revision to the OPAC CSS in order for
them to display well.

To test, apply the patch and view a page in the OPAC which includes a
DataTable. For instance: checkouts on the "your summary" page, serial
issues on the "full subscription history" page.

Tables should display correctly and sorting should work correctly. There
should be no other DataTables controls visible.

To test translatability:

To test, apply the patch and test that the correct strings are
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
      the templates  e.g.  misc/translator/po/fr-FR-opac-bootstrap.po
    - Locate strings pulled from bootstrap/en/includes/datatables.inc
      for translation, e.g.:

      #. SCRIPT
      #: opac-tmpl/bootstrap/en/includes/datatables.inc:4
      msgid "Copy to clipboard"
      msgstr ""

    - Edit the "msgstr" string however you want (it's just for testing)
    - Install the updated translation:

      > perl translate install fr-FR

Open the translated copy of datatables.inc and confirm that the
translated string appears.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-07-16 15:33:29 +01:00

26 lines
1.3 KiB
PHP

[% USE raw %]
[% USE Asset %]
[% Asset.js("lib/jquery/plugins/jquery.dataTables.min.js") | $raw %]
<script>
var MSG_DT_FIRST = _("First");
var MSG_DT_LAST = _("Last");
var MSG_DT_NEXT = _("Next");
var MSG_DT_PREVIOUS = _("Previous");
var MSG_DT_EMPTY_TABLE = _("No data available in table");
var MSG_DT_INFO = _("Showing _START_ to _END_ of _TOTAL_");
var MSG_DT_INFO_EMPTY = _("No entries to show");
var MSG_DT_INFO_FILTERED = _("(filtered from _MAX_ total entries)");
var MSG_DT_LENGTH_MENU = _("Show _MENU_ entries");
var MSG_DT_LOADING_RECORDS = _("Loading...");
var MSG_DT_PROCESSING = _("Processing...");
var MSG_DT_SEARCH = _("Search:");
var MSG_DT_ZERO_RECORDS = _("No matching records found");
var MSG_DT_COPY_TO_CLIPBOARD = _("Copy to clipboard");
var MSG_DT_COPY_KEYS = _("Press <i>ctrl</i> or <i>⌘</i> + <i>C</i> to copy the table data<br>to your system clipboard.<br><br>To cancel, click this message or press escape.");
var MSG_DT_COPIED_ROWS = _("Copied %d rows to clipboard");
var MSG_DT_COPIED_ONE_ROW = _("Copied one row to clipboard");
var MSG_CLEAR_FILTER = _("Clear filter");
var MSG_DT_ALL = _("All");
var CONFIG_EXCLUDE_ARTICLES_FROM_SORT = _("a an the");
</script>
[% Asset.js("js/datatables.js") | $raw %]