Bug 22490: Some strings in JavaScript files are untranslatable
Javascript function `_` works only if used in template file (.tt or
.inc).
In .js files we should use `__`
This patch updates .js files to use `__` instead of `_`
Test Plan:
1. Do not apply the patch yet
2. Run `npx gulp po:update --lang fr-FR` (choose another language
if you prefer)
3. Open misc/translator/po/fr-FR-messages-js.po and search "Please
select a CSV (.csv) or ODS (.ods) spreadsheet file"
4. Notice that the references above only mention biblio_framework.js
5. If not already translated, translate it
6. Run misc/translator/translate install fr-FR
7. Go to staff interface and change language to fr-FR
8. Go to Administration » Authority types and click on "Actions ->
Import"
9. In the modal window, click on "Import" without selecting a file. You
should see an alert with the non-translated text
10. Apply the patch
11. Run `npx gulp po:update --lang fr-FR`
12. Open misc/translator/po/fr-FR-messages-js.po and search "Please
select a CSV (.csv) or ODS (.ods) spreadsheet file"
13. Notice that the references above now also mention authtype.js
14. If the translation is marked as fuzzy, remove the fuzzy flag
15. Run misc/translator/translate install fr-FR
16. Go to staff interface again
17. Go to Administration » Authority types and click on "Actions ->
Import"
18. In the modal window, click on "Import" without selecting a file. You
should see an alert, this time with the translated text
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
c564c8a696
commit
6498c5835c
|
|
@ -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("<strong>" + authtypecode + "</strong>", "<i>" + obj.val().replace(new RegExp("^.+[/\\\\]"),"") + "</i>"));
|
||||
$('#importing_' + authtypecode).find("span").html(__("Importing to authority type: %s. Importing from file: %s").format("<strong>" + authtypecode + "</strong>", "<i>" + obj.val().replace(new RegExp("^.+[/\\\\]"),"") + "</i>"));
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ function submitBackgroundJob(f) {
|
|||
backgroundJobProgressTimer = setInterval("updateJobProgress()", 500);
|
||||
},
|
||||
error: function(xml, textStatus) {
|
||||
humanMsg.displayMsg( '<p>' + _('Import of record(s) failed: ') + textStatus + '</p></br>'+xml.responseText, { className: 'humanError' } );
|
||||
humanMsg.displayMsg( '<p>' + __('Import of record(s) failed: ') + textStatus + '</p></br>'+xml.responseText, { className: 'humanError' } );
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -875,7 +875,7 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) {
|
|||
if ( existing_search ) {
|
||||
$(this).html( '<input type="text" value="%s" style="width: 100%" />'.format(existing_search) );
|
||||
} else {
|
||||
var search_title = _("%s search").format(title);
|
||||
var search_title = __("%s search").format(title);
|
||||
$(this).html( '<input type="text" placeholder="%s" style="width: 100%" />'.format(search_title) );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -147,7 +147,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 {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -32,13 +32,13 @@ function count_reject () {
|
|||
}
|
||||
|
||||
var success_approve = function(tag){
|
||||
// window.alert(_("AJAX approved tag: ") + tag);
|
||||
// window.alert(__("AJAX approved tag: ") + tag);
|
||||
};
|
||||
var failure_approve = function(tag){
|
||||
window.alert( __("AJAX failed to approve tag: %s").format(decodeURIComponent(tag)) );
|
||||
};
|
||||
var success_reject = function(tag){
|
||||
// window.alert(_("AJAX rejected tag: ") + tag);
|
||||
// window.alert(__("AJAX rejected tag: ") + tag);
|
||||
};
|
||||
var failure_reject = function(tag){
|
||||
window.alert( __("AJAX failed to reject tag: %s").format(decodeURIComponent(tag)) );
|
||||
|
|
@ -55,7 +55,7 @@ var indeterminate_test = function(tag){
|
|||
|
||||
var success_test_call = function() {
|
||||
$('#test_button').prop('disabled', false);
|
||||
$('#test_button').html("<i class='fa fa-check-square-o' aria-hidden='true'></i>" +_(" Test"));
|
||||
$('#test_button').html("<i class='fa fa-check-square-o' aria-hidden='true'></i>" +__(" Test"));
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
|
|
@ -100,7 +100,7 @@ $(document).ready(function() {
|
|||
pull_counts();
|
||||
var getelement;
|
||||
var gettitle;
|
||||
// window.alert(_("Click detected on ") + event.target + ": " + $(event.target).html);
|
||||
// window.alert(__("Click detected on ") + event.target + ": " + $(event.target).html);
|
||||
if ($(event.target).is('.ok')) {
|
||||
$.ajax(Object.assign({}, review_ajax_params, {
|
||||
data: {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ function patron_autocomplete(node, options) {
|
|||
},
|
||||
error: function(e) {
|
||||
if ( e.state() != 'rejected' ) {
|
||||
alert( _("An error occurred. Check the logs") );
|
||||
alert( __("An error occurred. Check the logs") );
|
||||
}
|
||||
return response();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ $('body').on('click', '.return-claim-tools-resolve', function() {
|
|||
$('#claims-returned-resolved-modal-id').val(id);
|
||||
$("#new_lost_status").val(current_lost_status);
|
||||
let selected_option = $("#new_lost_status option:selected");
|
||||
$(selected_option).text(_("%s (current status)").format($(selected_option).text()));
|
||||
$(selected_option).text(__("%s (current status)").format($(selected_option).text()));
|
||||
$('#claims-returned-resolved-modal').modal()
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ function changeH4Result(form, h4_result, tr_result, pos, value)
|
|||
}).responseXML;
|
||||
if (this.xmlDoc) this.renderTemplate();
|
||||
$("*").ajaxError(function(evt, request, settings){
|
||||
alert(_("AJAX error: receiving data from %s").format(settings.url));
|
||||
alert(__("AJAX error: receiving data from %s").format(settings.url));
|
||||
});
|
||||
},//loadXmlValues
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue