From fd4d222c25d6b3dc70abc63262006352d0d69b9b Mon Sep 17 00:00:00 2001 From: Srdjan Date: Mon, 13 Nov 2017 14:25:33 +1300 Subject: [PATCH] Bug 17602: Translations rework --- .../bootstrap/en/includes/opac-bottom.inc | 23 ++++++++++++++++++ .../en/modules/opac-recordedbooks-search.tt | 16 ++++++------- .../opac-tmpl/bootstrap/en/modules/opac-results.tt | 18 +++++++------- koha-tmpl/opac-tmpl/bootstrap/js/recordedbooks.js | 28 +++++++++++----------- 4 files changed, 54 insertions(+), 31 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc index 8346691..a7fc0fb 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc @@ -113,6 +113,29 @@ $.widget.bridge('uitooltip', $.ui.tooltip); var MSG_CONFIRM_AGAIN = _("Warning: Cannot be undone. Please confirm once again") var MSG_DELETE_SEARCH_HISTORY = _("Are you sure you want to delete your search history?"); var MSG_NO_SUGGESTION_SELECTED = _("No suggestion was selected"); + var MSG_SEARCHING = _("Searching %s..."); + var MSG_ERROR_SEARCHING_COLLECTION = _("Error searching %s collection"); + var MSG_NO_RESULTS_FOUND_IN_COLLECTION = _("No results found in the library's %s collection"); + var MSG_RESULTS_FOUND_IN_COLLECTION = _("Found %s results in the library's %s collection"); + var MSG_BY = _("by"); + var MSG_TYPE = _("Type"); + var MSG_NEXT = _("Next"); + var MSG_PREVIOUS = _("Previous"); + var MSG_CHECKOUTS = _("Checkouts"); + var MSG_NO_CHECKOUTS = _("No checkouts"); + var MSG_CHECK_OUT = _("Check out"); + var MSG_CHECK_OUT_CONFIRM = _("Are you sure you want to checkout this item?"); + var MSG_CHECKED_OUT_UNTIL = _("Checked out until %s"); + var MSG_CHECK_IN = _("Check in"); + var MSG_CHECK_IN_CONFIRM = _("Are you sure you want to return this item?"); + var MSG_NO_CHECKOUTS = _("No checkouts"); + var MSG_DOWNLOAD = _("Download"); + var MSG_HOLDS = _("Holds"); + var MSG_NO_HOLDS = _("No holds"); + var MSG_PLACE_HOLD = _("Place hold"); + var MSG_CANCEL_HOLD = _("Cancel"); + var MSG_CANCEL_HOLD_CONFIRM = _("Are you sure you want to cancel this hold?"); + var MSG_ON_HOLD = _("On hold"); [% IF Koha.Preference( 'opacbookbag' ) == 1 or Koha.Preference( 'virtualshelves' ) == 1 %] var MSG_BASKET_EMPTY = _("Your cart is currently empty"); var MSG_RECORD_IN_BASKET = _("The item is already in your cart"); diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recordedbooks-search.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recordedbooks-search.tt index b90f6ac..07c9f05 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recordedbooks-search.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recordedbooks-search.tt @@ -66,22 +66,22 @@ var querystring = "[% q |replace( "'", "\'" ) |replace( '\n', '\\n' ) |replace( var results_per_page = [% OPACnumSearchResults || 20 %]; function search( page ) { - $( '#recordedbooks-status' ).html( _("Searching RecordedBooks...") + ' ' ); + $( '#recordedbooks-status' ).html( MSG_SEARCHING.format("RecordedBooks") + ' ' ); KOHA.RecordedBooks.search( querystring, results_per_page, page, function( data ) { if ( data.error ) { - $( '#recordedbooks-status' ).html( '' + _("Error searching RecordedBooks collection") + ': ' + data.error + '' ); + $( '#recordedbooks-status' ).html( '' + MSG_ERROR_SEARCHING_COLLECTION.format("RecordedBooks") + ': ' + data.error + '' ); return; } if ( !data.total ) { - $( '#recordedbooks-status' ).html( '' + _("No results found in the library's RecordedBooks collection.") + '' ); + $( '#recordedbooks-status' ).html( '' + MSG_NO_RESULTS_FOUND_IN_COLLECTION.format("RecordedBooks") + '' ); return; } $( '#recordedbooks-results-list tbody' ).empty(); - $( '#recordedbooks-status' ).html( '' + _("Found") + ' ' + data.total + ' ' + _("results in the library's RecordedBooks collection.") + '' ); + $( '#recordedbooks-status' ).html( '' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.total, "RecordedBooks") + '' ); for ( var i = 0; data.items[i]; i++ ) { var prod = data.items[i]; @@ -94,9 +94,9 @@ function search( page ) { results.push( prod.title ); if (prod.url) results.push( '' ); results.push( '' ); - results.push( '

' + _("by") + ' ', prod.author, '

' ); + results.push( '

' + MSG_BY + ' ', prod.author, '

' ); if (prod.description) results.push( '

' + prod.description, '

' ); - results.push( '' + _("Type:") + ' ', prod.media, '' ); + results.push( '' + MSG_TYPE + ': ', prod.media, '' ); results.push( '' ); @@ -125,7 +125,7 @@ function search( page ) { if (data.total == page*results_per_page) max_page++; if ( page != 1 ) { - pages.push( '
  • « ' + _("Previous") + '
  • ' ); + pages.push( '
  • « ' + MSG_PREVIOUS + '
  • ' ); } for ( var p = Math.max( 0, page - 9 ); p <= Math.min( max_page, p + 9 ); p++ ) { @@ -137,7 +137,7 @@ function search( page ) { } if ( page < max_page ) { - pages.push( '
  • ' + _("Next") + ' »
  • ' ); + pages.push( '
  • ' + MSG_NEXT + ' »
  • ' ); } if ( pages.length > 1 ) $( '#top-pages, #bottom-pages' ).find( '.pagination' ).html( ''); diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt index e6c66e6..6c569d2 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -892,52 +892,52 @@ $(document).ready(function(){ $("#highlight_toggle_off").show().click(function() {highlightOff();}); [% END %] [% IF ( OverDriveEnabled ) %] - var $overdrive_results = $( '
    ' + _( 'Searching OverDrive...' ) + '
    ' ); + var $overdrive_results = $( '
    ' + MSG_SEARCHING.format('OverDrive') + '
    ' ); $( '#numresults' ) .append( ' ' ) .append( $overdrive_results ); KOHA.OverDrive.Search( "[% OverDriveLibraryID %]", querystring, 1, 0, function( data ) { if ( data.error ) { - $overdrive_results.html( _( 'Error searching OverDrive collection' ) ); + $overdrive_results.html( MSG_ERROR_SEARCHING_COLLECTION.format('OverDrive') ); return; } if ( data.totalItems ) { - $overdrive_results.html( _( 'Found' ) + ' ' + data.totalItems + ' ' + _( 'results' ) + ' ' + _( 'in OverDrive collection' ) ); + $overdrive_results.html( '' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.totalItems, 'OverDrive') + '' ); } else { $overdrive_results.remove(); } } ); [% END %] [% IF ( RecordedBooksEnabled ) %] - var $recordedbooks_results = $( '
    ' + _( "Searching RecordedBooks..." ) + '
    ' ); + var $recordedbooks_results = $( '
    ' + MSG_SEARCHING.format('RecordedBooks') + '
    ' ); $( '#numresults' ) .append( ' ' ) .append( $recordedbooks_results ); KOHA.RecordedBooks.search( querystring, [% OPACnumSearchResults || "null" %], null, function( data ) { if ( data.error ) { - $recordedbooks_results.html( _( "Error searching RecordedBooks collection: %s" ).format( data.error ) ); + $recordedbooks_results.html( MSG_ERROR_SEARCHING_COLLECTION.format('RecordedBooks') + ': ' + data.error); return; } // data.total can be either 42 or "60+" if ( typeof(data.total) === 'string' && data.total.charAt(0) > 0 || typeof(data.total) === 'number' && data.total > 0 ) { - $recordedbooks_results.html( _( "Found %s results in RecordedBooks collection" ).format('' + data.total + '') ); + $recordedbooks_results.html( '' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.total, 'RecordedBooks') + '' ); } else { $recordedbooks_results.remove(); } } ); [% END %] [% IF ( OpenLibrarySearch ) %] - var $openlibrary_results = $( '
    ' + _( 'Searching Open Library...' ) + '
    ' ); + var $openlibrary_results = $( '
    ' + MSG_SEARCHING.format('OpenLibrary' ) + '
    ' ); $( '#numresults' ) .append( ' ' ) .append( $openlibrary_results ); KOHA.OpenLibrary.search( querystring, null, function( data ) { if ( data.error ) { - $openlibrary_results.html( _( 'Error searching OpenLibrary collection' ) ); + $openlibrary_results.html( MSG_ERROR_SEARCHING_COLLECTION.format('OpenLibrary') ); return; } if ( data.numFound > 0 ) { - $openlibrary_results.html( _( 'Found' ) + ' ' + data.numFound + ' ' + _( 'results' ) + ' ' + _( 'in OpenLibrary collection' ) ); + $openlibrary_results.html( '' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.numFound, 'OpenLibrary') + '' ); } else { $openlibrary_results.remove(); } diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/recordedbooks.js b/koha-tmpl/opac-tmpl/bootstrap/js/recordedbooks.js index 5df3f3a..b0aeccb 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/recordedbooks.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/recordedbooks.js @@ -27,11 +27,11 @@ KOHA.RecordedBooks = new function() { } if (data.checkouts) { - var checkouts_div = $('
    ').html('

    ' + _("Checkouts") + '

    '); + var checkouts_div = $('
    ').html('

    ' + MSG_CHECKOUTS + '

    '); var items = data.checkouts.items; var checkouts_list; if (items.length == 0) { - checkouts_list = _("No checkouts"); + checkouts_list = MSG_NO_CHECKOUTS; } else { checkouts_list = $('