From 8f8beafd5619bde6ceebf30f0d8bfbfaa58973ae Mon Sep 17 00:00:00 2001 From: Aleksander Machniak <alec@alec.pl> Date: Tue, 20 Oct 2015 04:08:50 -0400 Subject: [PATCH] Use .get_label() consistently (instead of .gettext()) --- plugins/attachment_reminder/attachment_reminder.js | 8 ++-- plugins/hide_blockquote/hide_blockquote.js | 4 +- plugins/password/password.js | 8 ++-- plugins/zipdownload/zipdownload.js | 2 plugins/acl/acl.js | 6 +- program/js/editor.js | 4 +- plugins/newmail_notifier/newmail_notifier.js | 30 +++++++------- plugins/enigma/enigma.js | 10 ++-- plugins/managesieve/managesieve.js | 10 ++-- plugins/userinfo/userinfo.js | 10 +++-- program/js/app.js | 10 ++-- 11 files changed, 52 insertions(+), 50 deletions(-) diff --git a/plugins/acl/acl.js b/plugins/acl/acl.js index f1e9922..3647650 100644 --- a/plugins/acl/acl.js +++ b/plugins/acl/acl.js @@ -344,13 +344,13 @@ var buttons = {}, me = this, body = document.body; - buttons[this.gettext('save')] = function(e) { me.command('acl-save'); }; - buttons[this.gettext('cancel')] = function(e) { me.command('acl-cancel'); }; + buttons[this.get_label('save')] = function(e) { me.command('acl-save'); }; + buttons[this.get_label('cancel')] = function(e) { me.command('acl-cancel'); }; // display it as popup this.acl_popup = this.show_popup_dialog( this.acl_form.show(), - id ? this.gettext('acl.editperms') : this.gettext('acl.newuser'), + id ? this.get_label('acl.editperms') : this.get_label('acl.newuser'), buttons, { button_classes: ['mainaction'], diff --git a/plugins/attachment_reminder/attachment_reminder.js b/plugins/attachment_reminder/attachment_reminder.js index d6cf8e4..4626ce7 100755 --- a/plugins/attachment_reminder/attachment_reminder.js +++ b/plugins/attachment_reminder/attachment_reminder.js @@ -33,7 +33,7 @@ function rcmail_check_message(msg) { - var i, rx, keywords = rcmail.gettext('keywords', 'attachment_reminder').split(",").concat([".doc", ".pdf"]); + var i, rx, keywords = rcmail.get_label('keywords', 'attachment_reminder').split(",").concat([".doc", ".pdf"]); keywords = $.map(keywords, function(n) { return RegExp.escape(n); }); rx = new RegExp('(' + keywords.join('|') + ')', 'i'); @@ -50,21 +50,21 @@ { var buttons = {}; - buttons[rcmail.gettext('addattachment')] = function() { + buttons[rcmail.get_label('addattachment')] = function() { $(this).remove(); if (window.UI && UI.show_uploadform) // Larry skin UI.show_uploadform(); else if (window.rcmail_ui && rcmail_ui.show_popup) // classic skin rcmail_ui.show_popup('uploadmenu', true); }; - buttons[rcmail.gettext('send')] = function(e) { + buttons[rcmail.get_label('send')] = function(e) { $(this).remove(); rcmail.env.attachment_reminder = true; rcmail.command('send', '', e); }; rcmail.env.attachment_reminder = false; - rcmail.show_popup_dialog(rcmail.gettext('attachment_reminder.forgotattachment'), '', buttons); + rcmail.show_popup_dialog(rcmail.get_label('attachment_reminder.forgotattachment'), '', buttons); }; diff --git a/plugins/enigma/enigma.js b/plugins/enigma/enigma.js index c9a2a75..aca4ec0 100644 --- a/plugins/enigma/enigma.js +++ b/plugins/enigma/enigma.js @@ -82,13 +82,13 @@ // validate the form if (!password || !confirm) - return alert(this.gettext('enigma.formerror')); + return alert(this.get_label('enigma.formerror')); if (password != confirm) - return alert(this.gettext('enigma.passwordsdiffer')); + return alert(this.get_label('enigma.passwordsdiffer')); if (user.match(/^<[^>]+>$/)) - return alert(this.gettext('enigma.nonameident')); + return alert(this.get_label('enigma.nonameident')); // generate keys // use OpenPGP.js if browser supports required features @@ -109,7 +109,7 @@ }).catch(function(error) { // failure rcmail.set_busy(false, null, lock); - rcmail.display_message(rcmail.gettext('enigma.keygenerateerror'), 'error'); + rcmail.display_message(rcmail.get_label('enigma.keygenerateerror'), 'error'); }); } // generate keys on the server @@ -119,7 +119,7 @@ rcmail.http_post('plugin.enigmakeys', options, lock); } else { - rcmail.display_message(rcmail.gettext('enigma.keygennosupport'), 'error'); + rcmail.display_message(rcmail.get_label('enigma.keygennosupport'), 'error'); } }; diff --git a/plugins/hide_blockquote/hide_blockquote.js b/plugins/hide_blockquote/hide_blockquote.js index 964cc07..d3da843 100644 --- a/plugins/hide_blockquote/hide_blockquote.js +++ b/plugins/hide_blockquote/hide_blockquote.js @@ -43,12 +43,12 @@ link = $('<span class="blockquote-link"></span>') .css({position: 'absolute', 'z-Index': 2}) - .text(rcmail.gettext('hide_blockquote.show')) + .text(rcmail.get_label('hide_blockquote.show')) .data('parent', div) .click(function() { var t = $(this), parent = t.data('parent'), visible = parent.is(':visible'); - t.text(rcmail.gettext(visible ? 'hide' : 'show', 'hide_blockquote')) + t.text(rcmail.get_label(visible ? 'hide' : 'show', 'hide_blockquote')) .detach().appendTo(visible ? q : parent); parent[visible ? 'hide' : 'show'](); diff --git a/plugins/managesieve/managesieve.js b/plugins/managesieve/managesieve.js index b8af287..a69fa5a 100644 --- a/plugins/managesieve/managesieve.js +++ b/plugins/managesieve/managesieve.js @@ -983,7 +983,7 @@ } // build dialog window content - html = '<fieldset><legend>'+this.gettext('managesieve.usedata')+'</legend><ul>'; + html = '<fieldset><legend>'+this.get_label('managesieve.usedata')+'</legend><ul>'; for (i in this.env.sieve_headers) html += '<li><input type="checkbox" name="headers[]" id="sievehdr'+i+'" value="'+i+'" checked="checked" />' +'<label for="sievehdr'+i+'">'+this.env.sieve_headers[i][0]+':</label> '+this.env.sieve_headers[i][1]+'</li>'; @@ -992,11 +992,11 @@ dialog.html(html); // [Next Step] button action - buttons[this.gettext('managesieve.nextstep')] = function () { + buttons[this.get_label('managesieve.nextstep')] = function () { // check if there's at least one checkbox checked var hdrs = $('input[name="headers[]"]:checked', dialog); if (!hdrs.length) { - alert(rcmail.gettext('managesieve.nodata')); + alert(rcmail.get_label('managesieve.nodata')); return; } @@ -1016,7 +1016,7 @@ // Change [Next Step] button with [Save] button buttons = {}; - buttons[rcmail.gettext('save')] = function() { + buttons[rcmail.get_label('save')] = function() { var win = $('iframe', dialog).get(0).contentWindow; win.rcmail.managesieve_save(); }; @@ -1028,7 +1028,7 @@ modal: false, resizable: true, closeOnEscape: !bw.ie7, // disable for performance reasons - title: this.gettext('managesieve.newfilter'), + title: this.get_label('managesieve.newfilter'), close: function() { rcmail.managesieve_dialog_close(); }, buttons: buttons, minWidth: 600, diff --git a/plugins/newmail_notifier/newmail_notifier.js b/plugins/newmail_notifier/newmail_notifier.js index 79911f2..4b71c22 100644 --- a/plugins/newmail_notifier/newmail_notifier.js +++ b/plugins/newmail_notifier/newmail_notifier.js @@ -18,13 +18,13 @@ */ if (window.rcmail && rcmail.env.task == 'mail') { - rcmail.addEventListener('plugin.newmail_notifier', newmail_notifier_run); - rcmail.addEventListener('actionbefore', newmail_notifier_stop); - rcmail.addEventListener('init', function() { - // bind to messages list select event, so favicon will be reverted on message preview too - if (rcmail.message_list) - rcmail.message_list.addEventListener('select', newmail_notifier_stop); - }); + rcmail.addEventListener('plugin.newmail_notifier', newmail_notifier_run) + .addEventListener('actionbefore', newmail_notifier_stop) + .addEventListener('init', function() { + // bind to messages list select event, so favicon will be reverted on message preview too + if (rcmail.message_list) + rcmail.message_list.addEventListener('select', newmail_notifier_stop); + }); } // Executes notification methods @@ -35,7 +35,7 @@ if (prop.sound) newmail_notifier_sound(); if (prop.desktop) - newmail_notifier_desktop(rcmail.gettext('body', 'newmail_notifier')); + newmail_notifier_desktop(rcmail.get_label('body', 'newmail_notifier')); } // Stops notification @@ -76,7 +76,7 @@ // Add IE icon overlay if we're pinned to Taskbar try { if (window.external.msIsSiteMode()) { - window.external.msSiteModeSetIconOverlay(path + '/overlay.ico', rcmail.gettext('title', 'newmail_notifier')); + window.external.msSiteModeSetIconOverlay(path + '/overlay.ico', rcmail.get_label('title', 'newmail_notifier')); } } catch(e) {} } @@ -118,7 +118,7 @@ // https://code.google.com/p/chromium/issues/detail?id=163226 try { if (Notification.permission == 'granted' || Notification.permission == undefined) { - var popup = new Notification(rcmail.gettext('title', 'newmail_notifier'), { + var popup = new Notification(rcmail.get_label('title', 'newmail_notifier'), { dir: "auto", lang: "", body: body, @@ -139,7 +139,7 @@ if (rcmail.newmail_popup) rcmail.newmail_popup.cancel(); var popup = window.webkitNotifications.createNotification(icon, - rcmail.gettext('title', 'newmail_notifier'), body); + rcmail.get_label('title', 'newmail_notifier'), body); popup.onclick = function() { this.cancel(); } @@ -154,7 +154,7 @@ function newmail_notifier_test_desktop() { - var txt = rcmail.gettext('testbody', 'newmail_notifier'); + var txt = rcmail.get_label('testbody', 'newmail_notifier'); // W3C draft implementation (with fix for Chrome/Chromium) try { @@ -171,12 +171,12 @@ else dn.requestPermission(function() { if (!newmail_notifier_desktop(txt)) - rcmail.display_message(rcmail.gettext('desktopdisabled', 'newmail_notifier'), 'error'); + rcmail.display_message(rcmail.get_label('desktopdisabled', 'newmail_notifier'), 'error'); }); } else // Everything fails, means the browser has no support - rcmail.display_message(rcmail.gettext('desktopunsupported', 'newmail_notifier'), 'error'); + rcmail.display_message(rcmail.get_label('desktopunsupported', 'newmail_notifier'), 'error'); } } @@ -193,7 +193,7 @@ function newmail_notifier_desktop_authorize() { Notification.requestPermission(function(perm) { if (perm == 'denied') - rcmail.display_message(rcmail.gettext('desktopdisabled', 'newmail_notifier'), 'error'); + rcmail.display_message(rcmail.get_label('desktopdisabled', 'newmail_notifier'), 'error'); if (perm == 'granted') newmail_notifier_test_desktop(); // Test again, which should show test message }); diff --git a/plugins/password/password.js b/plugins/password/password.js index 75448ec..1782b90 100644 --- a/plugins/password/password.js +++ b/plugins/password/password.js @@ -30,19 +30,19 @@ input_confpasswd = rcube_find_object('_confpasswd'); if (input_curpasswd && input_curpasswd.value == '') { - alert(rcmail.gettext('nocurpassword', 'password')); + alert(rcmail.get_label('nocurpassword', 'password')); input_curpasswd.focus(); } else if (input_newpasswd && input_newpasswd.value == '') { - alert(rcmail.gettext('nopassword', 'password')); + alert(rcmail.get_label('nopassword', 'password')); input_newpasswd.focus(); } else if (input_confpasswd && input_confpasswd.value == '') { - alert(rcmail.gettext('nopassword', 'password')); + alert(rcmail.get_label('nopassword', 'password')); input_confpasswd.focus(); } else if (input_newpasswd && input_confpasswd && input_newpasswd.value != input_confpasswd.value) { - alert(rcmail.gettext('passwordinconsistency', 'password')); + alert(rcmail.get_label('passwordinconsistency', 'password')); input_newpasswd.focus(); } else { diff --git a/plugins/userinfo/userinfo.js b/plugins/userinfo/userinfo.js index 1c0c513..5b9c942 100644 --- a/plugins/userinfo/userinfo.js +++ b/plugins/userinfo/userinfo.js @@ -1,16 +1,18 @@ /* Show user-info plugin script */ if (window.rcmail) { - rcmail.addEventListener('init', function(evt) { + rcmail.addEventListener('init', function() { // <span id="settingstabdefault" class="tablink"><roundcube:button command="preferences" type="link" label="preferences" title="editpreferences" /></span> var tab = $('<span>').attr('id', 'settingstabpluginuserinfo').addClass('tablink'); - var button = $('<a>').attr('href', rcmail.env.comm_path+'&_action=plugin.userinfo').html(rcmail.gettext('userinfo', 'userinfo')).appendTo(tab); - button.click(function(e) { return rcmail.command('plugin.userinfo', this); }); + $('<a>').attr('href', rcmail.env.comm_path + '&_action=plugin.userinfo') + .text(rcmail.get_label('userinfo', 'userinfo')) + .click(function(e) { return rcmail.command('plugin.userinfo', '', this, e); }) + .appendTo(tab); // add button and register command rcmail.add_element(tab, 'tabs'); - rcmail.register_command('plugin.userinfo', function(){ rcmail.goto_url('plugin.userinfo') }, true); + rcmail.register_command('plugin.userinfo', function() { rcmail.goto_url('plugin.userinfo') }, true); }) } diff --git a/plugins/zipdownload/zipdownload.js b/plugins/zipdownload/zipdownload.js index f949508..228b04f 100644 --- a/plugins/zipdownload/zipdownload.js +++ b/plugins/zipdownload/zipdownload.js @@ -43,7 +43,7 @@ link.html('').append(span); } - span.text(rcmail.gettext('zipdownload.download')); + span.text(rcmail.get_label('zipdownload.download')); rcmail.env.download_link = link; }); }); diff --git a/program/js/app.js b/program/js/app.js index 30b6f29..27fe3a4 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -4314,7 +4314,7 @@ '<textarea name="text" id="ffresponsetext" cols="40" rows="8"></textarea></div>' + '</form>'; - buttons[this.gettext('save')] = function(e) { + buttons[this.get_label('save')] = function(e) { var name = $('#ffresponsename').val(), text = $('#ffresponsetext').val(); @@ -4330,11 +4330,11 @@ $(this).dialog('close'); }; - buttons[this.gettext('cancel')] = function() { + buttons[this.get_label('cancel')] = function() { $(this).dialog('close'); }; - this.show_popup_dialog(html, this.gettext('newresponse'), buttons, {button_classes: ['mainaction']}); + this.show_popup_dialog(html, this.get_label('newresponse'), buttons, {button_classes: ['mainaction']}); $('#ffresponsetext').val(text); $('#ffresponsename').select(); @@ -5570,7 +5570,7 @@ // add link to pop back to parent group if (this.env.address_group_stack.length > 1) { $('<a href="#list">...</a>') - .attr('title', this.gettext('uponelevel')) + .attr('title', this.get_label('uponelevel')) .addClass('poplink') .appendTo(boxtitle) .click(function(e){ return ref.command('popgroup','',this); }); @@ -8409,7 +8409,7 @@ if (uri = e.dataTransfer.getData('roundcube-uri')) { var ts = new Date().getTime(), // jQuery way to escape filename (#1490530) - content = $('<span>').text(e.dataTransfer.getData('roundcube-name') || this.gettext('attaching')).html(); + content = $('<span>').text(e.dataTransfer.getData('roundcube-name') || this.get_label('attaching')).html(); args._uri = uri; args._uploadid = ts; diff --git a/program/js/editor.js b/program/js/editor.js index 5193f8c..0ad86bf 100644 --- a/program/js/editor.js +++ b/program/js/editor.js @@ -591,7 +591,7 @@ // open image selector dialog dialog = this.editor.windowManager.open({ - title: rcmail.gettext('select' + type), + title: rcmail.get_label('select' + type), width: 500, height: 300, html: '<div id="image-selector-list"><ul></ul></div>' @@ -618,7 +618,7 @@ .text($('div.hint', rcmail.gui_objects.uploadform).text())); // init upload button - elem = $('#image-upload-button').append($('<span>').text(rcmail.gettext('add' + type))); + elem = $('#image-upload-button').append($('<span>').text(rcmail.get_label('add' + type))); cancel = elem.parents('.mce-panel').find('button:last').parent(); // we need custom Tab key handlers, until we find out why -- Gitblit v1.9.1