From 28bce7d1822da29488fb2e84dc9bdce425a233da Mon Sep 17 00:00:00 2001 From: jeremy breuillard Date: Mon, 25 Apr 2022 15:03:32 +0200 Subject: [PATCH] Bug 22490: Some strings in JavaScript files are untranslatable This patch updates the translation functions of the strings in Javascript files Test Plan: 1) Find a string in a popup or from a Javascript file who is still not translated or 1) Home > Administration > Authority types 2) Make sure to have at least one Authority type saved 3) Click on Action > Import 4) Import button without adding any file to trigger the popup 5) The string inside the popup appears without translation 6) Apply patch and repeat from 3) to 5) : now the string is translated --- .../lib/koha/cateditor/koha-backend.js | 6 +++--- .../lib/koha/cateditor/marc-editor.js | 2 +- .../prog/en/modules/circ/overdue.tt | 18 ++++++++++++++++++ koha-tmpl/intranet-tmpl/prog/js/authtype.js | 8 ++++---- .../prog/js/background-job-progressbar.js | 2 +- koha-tmpl/intranet-tmpl/prog/js/calendar.js | 2 +- .../prog/js/item_search_fields.js | 2 +- koha-tmpl/intranet-tmpl/prog/js/letter.js | 2 +- .../intranet-tmpl/prog/js/pages/results.js | 6 +++--- .../intranet-tmpl/prog/js/pages/tags-review.js | 2 +- .../prog/js/rotating-collections.js | 2 +- 11 files changed, 35 insertions(+), 17 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js index eeca779440..5f7fdd9ec1 100644 --- a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js +++ b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js @@ -121,7 +121,7 @@ define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin } }); } ).fail( function( data ) { - callback( { error: _('Could not fetch frameworkcode for record') } ); + callback( { error: __('Could not fetch frameworkcode for record') } ); } ); } ); }, @@ -143,7 +143,7 @@ define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin } callback( record ); } ).fail( function( data ) { - callback( { error: _('Could not save record') } ); + callback( { error: __('Could not save record') } ); } ); }, @@ -164,7 +164,7 @@ define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin } callback( record ); } ).fail( function( data ) { - callback( { error: _('Could not save record') } ); + callback( { error: __('Could not save record') } ); } ); }, diff --git a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js index 6d90176e0a..7392e659ad 100644 --- a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js +++ b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js @@ -691,7 +691,7 @@ define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ], false, function ( error ) { if ( typeof error !== 'undefined' ) { - humanMsg.displayAlert( _(error), { className: 'humanError' } ); + humanMsg.displayAlert( __(error), { className: 'humanError' } ); } } ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt index 34df3aedec..ce0194e134 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt @@ -117,6 +117,24 @@ [% ItemTypes.GetDescription( overdueloo.itemtype ) | html %] [% overdueloo.replacementprice | $Price %] [% overdueloo.itemnotes_nonpublic | html %] +<<<<<<< Updated upstream +======= + [% IF ( overdueloo.return_claim_id != 0 ) %] + + [% IF ( overdueloo.return_claim_created_on ) %] + [% overdueloo.return_claim_created_on %] + [% ELSIF Koha.Preference('ClaimReturnedLostValue') %] + + Claim returned + + [% ELSE %] + + Claim returned + + [% END %] + + [% END %] +>>>>>>> Stashed changes [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/authtype.js b/koha-tmpl/intranet-tmpl/prog/js/authtype.js index f1ce1c87f2..9032dfbd8f 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/authtype.js +++ b/koha-tmpl/intranet-tmpl/prog/js/authtype.js @@ -41,7 +41,7 @@ $(document).ready(function() { var filename = $(this).val(); if ( ! /(?:\.csv|\.ods)$/.test(filename)) { $(this).css("background-color","yellow"); - alert(_("Please select a CSV (.csv) or ODS (.ods) spreadsheet file.")); + alert(__("Please select a CSV (.csv) or ODS (.ods) spreadsheet file.")); $(this).val(""); $(this).css("background-color","white"); } @@ -56,9 +56,9 @@ $(document).ready(function() { var id = $(this).attr('id'); var obj = $('#' + id + ' input:file'); if (/(?:\.csv|\.ods)$/.test(obj.val())) { - if (confirm(_("Do you really want to import the authority type fields and subfields? This will overwrite the current configuration. For safety reasons please use the export option to make a backup"))) { + if (confirm(__("Do you really want to import the authority type fields and subfields? This will overwrite the current configuration. For safety reasons please use the export option to make a backup"))) { var authtypecode = $('#' + id + ' input:hidden[name=authtypecode]').val(); - $('#importing_' + authtypecode).find("span").html(_("Importing to authority type: %s. Importing from file: %s").format("" + authtypecode + "", "" + obj.val().replace(new RegExp("^.+[/\\\\]"),"") + "")); + $('#importing_' + authtypecode).find("span").html(__("Importing to authority type: %s. Importing from file: %s").format("" + authtypecode + "", "" + obj.val().replace(new RegExp("^.+[/\\\\]"),"") + "")); if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) { var timestamp = new Date().getTime(); $('#importing_' + authtypecode).find("img").attr('src', '[% interface | html %]/[% theme | html %]/img/loading-small.gif' + '?' +timestamp); @@ -73,7 +73,7 @@ $(document).ready(function() { } } obj.css("background-color","yellow"); - alert(_("Please select a CSV (.csv) or ODS (.ods) spreadsheet file.")); + alert(__("Please select a CSV (.csv) or ODS (.ods) spreadsheet file.")); obj.val(""); bj.css("background-color","white"); return false; diff --git a/koha-tmpl/intranet-tmpl/prog/js/background-job-progressbar.js b/koha-tmpl/intranet-tmpl/prog/js/background-job-progressbar.js index 5ddb4053c2..52ee7380e4 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/background-job-progressbar.js +++ b/koha-tmpl/intranet-tmpl/prog/js/background-job-progressbar.js @@ -69,7 +69,7 @@ function submitBackgroundJob(f) { backgroundJobProgressTimer = setInterval("updateJobProgress()", 500); }, error: function(xml, textStatus) { - humanMsg.displayMsg( '

' + _('Import of record(s) failed: ') + textStatus + '


'+xml.responseText, { className: 'humanError' } ); + humanMsg.displayMsg( '

' + __('Import of record(s) failed: ') + textStatus + '


'+xml.responseText, { className: 'humanError' } ); } }); diff --git a/koha-tmpl/intranet-tmpl/prog/js/calendar.js b/koha-tmpl/intranet-tmpl/prog/js/calendar.js index 7a4a5083e8..9cf118d94f 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/calendar.js +++ b/koha-tmpl/intranet-tmpl/prog/js/calendar.js @@ -114,7 +114,7 @@ function DateTime_from_syspref(date_time) { }, messages: { input_name_of_later_date_field: { - is_date_after: _("Validation error to be shown, i.e. End date must come after start date") + is_date_after: __("Validation error to be shown, i.e. End date must come after start date") } } }); diff --git a/koha-tmpl/intranet-tmpl/prog/js/item_search_fields.js b/koha-tmpl/intranet-tmpl/prog/js/item_search_fields.js index 33d6c25058..92c98f3027 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/item_search_fields.js +++ b/koha-tmpl/intranet-tmpl/prog/js/item_search_fields.js @@ -2,7 +2,7 @@ jQuery.validator.addMethod("marcfield", function(value, element) { return this.optional(element) || /^[0-9a-zA-Z]+$/.test(value); -}, _("Please enter letters or numbers") ); +}, __("Please enter letters or numbers") ); $(document).ready(function(){ $("#add_field_form").hide(); diff --git a/koha-tmpl/intranet-tmpl/prog/js/letter.js b/koha-tmpl/intranet-tmpl/prog/js/letter.js index 84e63c9d96..cc7cb3c109 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/letter.js +++ b/koha-tmpl/intranet-tmpl/prog/js/letter.js @@ -120,7 +120,7 @@ $(document).ready(function() { $(".content_sms").on("keyup", function(){ var length = $(this).val().length; var sms_counter = ("#sms_counter_" + $(this).data('lang')); - $(sms_counter).html(length + "/" + sms_limit + _(" characters")); + $(sms_counter).html(length + "/" + sms_limit + __(" characters")); if ( length > sms_limit ) { $(sms_counter).css("color", "red"); } else { diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/results.js b/koha-tmpl/intranet-tmpl/prog/js/pages/results.js index 5320b3b3af..e901c629aa 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/pages/results.js +++ b/koha-tmpl/intranet-tmpl/prog/js/pages/results.js @@ -54,11 +54,11 @@ function verify_cover_images() { if( div.hasClass("coce-coverimg") ){ /* Identify which service's image is being loaded by IntranetCoce system pref */ if( $(img).attr("src").indexOf('amazon.com') >= 0 ){ - div.find(".hint").html(_("Coce image from Amazon.com")); + div.find(".hint").html(__("Coce image from Amazon.com")); } else if( $(img).attr("src").indexOf('google.com') >= 0 ){ - div.find(".hint").html(_("Coce image from Google Books")); + div.find(".hint").html(__("Coce image from Google Books")); } else if( $(img).attr("src").indexOf('openlibrary.org') >= 0 ){ - div.find(".hint").html(_("Coce image from Open Library")); + div.find(".hint").html(__("Coce image from Open Library")); } else { blanks.push( coverId ); div.remove(); diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js b/koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js index fb790551bd..d4a936a210 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js +++ b/koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js @@ -55,7 +55,7 @@ var indeterminate_test = function(tag){ var success_test_call = function() { $('#test_button').prop('disabled', false); - $('#test_button').html("" +_(" Test")); + $('#test_button').html("" +__(" Test")); }; $(document).ready(function() { diff --git a/koha-tmpl/intranet-tmpl/prog/js/rotating-collections.js b/koha-tmpl/intranet-tmpl/prog/js/rotating-collections.js index e7869382bf..91871a469e 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/rotating-collections.js +++ b/koha-tmpl/intranet-tmpl/prog/js/rotating-collections.js @@ -5,7 +5,7 @@ $(document).ready(function(){ $(".confirmdelete").click(function(){ $(this).parents('tr').addClass("warn"); - if(confirm(_("Are you sure you want to delete this rotating collection?"))){ + if(confirm(__("Are you sure you want to delete this rotating collection?"))){ return true; } else { $(this).parents('tr').removeClass("warn"); -- 2.17.1