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 <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Owen Leonard 2024-09-05 14:05:55 +00:00 committed by Katrin Fischer
parent 2685ac2c6c
commit 85d9861fb3
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
2 changed files with 12 additions and 8 deletions

View file

@ -109,7 +109,7 @@ sub pagination_bar {
# navigation bar useful only if more than one page to display !
if ( $nb_pages > 1 ) {
$pagination_bar = '<ul class="pagination">';
$pagination_bar = '<ul class="pagination output">';
# link to first page?
if ( $current_page > 1 ) {
@ -120,7 +120,7 @@ sub pagination_bar {
. $url . '1'
. $url_suffix
. '"rel="start">'
. '<i class="fa fa-fw fa-angle-double-left"></i> First'
. '<i class="fa fa-fw fa-angle-double-left"></i> '
. '</a></li>';
}
@ -136,7 +136,7 @@ sub pagination_bar {
. $previous
. $url_suffix
. '" rel="prev">'
. '<i class="fa fa-fw fa-angle-left"></i> Previous'
. '<i class="fa fa-fw fa-angle-left"></i> '
. '</a></li>';
}
@ -189,9 +189,7 @@ sub pagination_bar {
. $url
. $next
. $url_suffix
. '" rel="next">'
. 'Next <i class="fa fa-fw fa-angle-right"></i>'
. '</a></li>';
. '" rel="next"><i class="fa fa-fw fa-angle-right"></i></a></li>';
}
# link to last page?
@ -202,8 +200,7 @@ sub pagination_bar {
. $nb_pages
. $url_suffix
. '" rel="last">'
. 'Last <i class="fa fa-fw fa-angle-double-right"></i>'
. '</a></li>';
. ' <i class="fa fa-fw fa-angle-double-right"></i></a></li>';
}
$pagination_bar .= "\n" . '</ul>';

View file

@ -431,6 +431,13 @@ $(document).ready(function () {
if ($('[data-bs-toggle="tooltip"]').length) {
$('[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() {