Use .get_label() consistently (instead of .gettext())

pull/302/head
Aleksander Machniak 9 years ago
parent 5d84dd6de5
commit 8f8beafd56

@ -344,13 +344,13 @@ rcube_webmail.prototype.acl_init_form = function(id)
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'],

@ -33,7 +33,7 @@ function rcmail_get_compose_message()
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 @@ function rcmail_attachment_reminder_dialog()
{
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);
};

@ -82,13 +82,13 @@ rcube_webmail.prototype.enigma_key_create_save = function()
// 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 @@ rcube_webmail.prototype.enigma_key_create_save = function()
}).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 @@ rcube_webmail.prototype.enigma_key_create_save = function()
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');
}
};

@ -43,12 +43,12 @@ function hide_blockquote()
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']();

@ -983,7 +983,7 @@ rcube_webmail.prototype.managesieve_create = function(force)
}
// 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 @@ rcube_webmail.prototype.managesieve_create = function(force)
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 @@ rcube_webmail.prototype.managesieve_create = function(force)
// 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 @@ rcube_webmail.prototype.managesieve_create = function(force)
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,

@ -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 @@ function newmail_notifier_run(prop)
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 @@ function newmail_notifier_basic()
// 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 @@ function newmail_notifier_desktop(body)
// 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 @@ function newmail_notifier_desktop(body)
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_desktop(body)
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 @@ function newmail_notifier_test_desktop()
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_test_sound()
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
});

@ -30,19 +30,19 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
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 {

@ -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);
})
}

@ -43,7 +43,7 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
link.html('').append(span);
}
span.text(rcmail.gettext('zipdownload.download'));
span.text(rcmail.get_label('zipdownload.download'));
rcmail.env.download_link = link;
});
});

@ -4314,7 +4314,7 @@ function rcube_webmail()
'<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 @@ function rcube_webmail()
$(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 @@ function rcube_webmail()
// 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 @@ function rcube_webmail()
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;

@ -591,7 +591,7 @@ function rcube_text_editor(config, id)
// 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 @@ function rcube_text_editor(config, id)
.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

Loading…
Cancel
Save