From 7499ab95a64a963eccda4cb09b2aa3423c017936 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 5 Sep 2024 14:05:55 +0000 Subject: [PATCH] Bug 28453: (follow-up) Make pagination labels translatable This patch moves the English strings out of Output.pm and adds classes to the pagination markup which can be used as hooks for JavaScript. The global JS include is modified to look for these hooks and add text labels to the links. Signed-off-by: David Nind Signed-off-by: Jonathan Druart --- C4/Output.pm | 10 +++++----- koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 6 ++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/C4/Output.pm b/C4/Output.pm index 90fbad510b2..9172b308c59 100644 --- a/C4/Output.pm +++ b/C4/Output.pm @@ -110,7 +110,7 @@ sub pagination_bar { # navigation bar useful only if more than one page to display ! if ( $nb_pages > 1 ) { - $pagination_bar = '
    '; + $pagination_bar = '
      '; # link to first page? if ( $current_page > 1 ) { $pagination_bar .= @@ -120,7 +120,7 @@ sub pagination_bar { . '1' . $url_suffix . '"rel="start">' - . ' First' . ''; + . ' ' . ''; } # link on previous page ? @@ -133,7 +133,7 @@ sub pagination_bar { . $url . $previous . $url_suffix - . '" rel="prev">' . ' Previous' . ''; + . '" rel="prev">' . ' ' . ''; } my $min_to_display = $current_page - $pages_around; @@ -185,7 +185,7 @@ sub pagination_bar { . $url . $next . $url_suffix - . '" rel="next">' . 'Next ' . ''; + . '" rel="next">'; } # link to last page? @@ -196,7 +196,7 @@ sub pagination_bar { . $nb_pages . $url_suffix . '" rel="last">' - . 'Last ' . ''; + . ' '; } $pagination_bar .= "\n" . '
    '; diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index e76bf876f68..52f23942000 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -392,6 +392,12 @@ $(document).ready(function () { $('[data-bs-toggle="tooltip"]').tooltip(); } + if( $(".pagination.output").length > 0 ){ + $(".output.first").append( __("First") ); + $(".output.previous").append( __("Previous") ); + $(".output.next").prepend( __("Next") ); + $(".output.last").prepend( __("Last") ); + } }); function removeLastBorrower() { -- 2.34.1