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; var buttons = {}, me = this, body = document.body;
buttons[this.gettext('save')] = function(e) { me.command('acl-save'); }; buttons[this.get_label('save')] = function(e) { me.command('acl-save'); };
buttons[this.gettext('cancel')] = function(e) { me.command('acl-cancel'); }; buttons[this.get_label('cancel')] = function(e) { me.command('acl-cancel'); };
// display it as popup // display it as popup
this.acl_popup = this.show_popup_dialog( this.acl_popup = this.show_popup_dialog(
this.acl_form.show(), 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, buttons,
{ {
button_classes: ['mainaction'], button_classes: ['mainaction'],

@ -33,7 +33,7 @@ function rcmail_get_compose_message()
function rcmail_check_message(msg) 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); }); keywords = $.map(keywords, function(n) { return RegExp.escape(n); });
rx = new RegExp('(' + keywords.join('|') + ')', 'i'); rx = new RegExp('(' + keywords.join('|') + ')', 'i');
@ -50,21 +50,21 @@ function rcmail_attachment_reminder_dialog()
{ {
var buttons = {}; var buttons = {};
buttons[rcmail.gettext('addattachment')] = function() { buttons[rcmail.get_label('addattachment')] = function() {
$(this).remove(); $(this).remove();
if (window.UI && UI.show_uploadform) // Larry skin if (window.UI && UI.show_uploadform) // Larry skin
UI.show_uploadform(); UI.show_uploadform();
else if (window.rcmail_ui && rcmail_ui.show_popup) // classic skin else if (window.rcmail_ui && rcmail_ui.show_popup) // classic skin
rcmail_ui.show_popup('uploadmenu', true); rcmail_ui.show_popup('uploadmenu', true);
}; };
buttons[rcmail.gettext('send')] = function(e) { buttons[rcmail.get_label('send')] = function(e) {
$(this).remove(); $(this).remove();
rcmail.env.attachment_reminder = true; rcmail.env.attachment_reminder = true;
rcmail.command('send', '', e); rcmail.command('send', '', e);
}; };
rcmail.env.attachment_reminder = false; 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 // validate the form
if (!password || !confirm) if (!password || !confirm)
return alert(this.gettext('enigma.formerror')); return alert(this.get_label('enigma.formerror'));
if (password != confirm) if (password != confirm)
return alert(this.gettext('enigma.passwordsdiffer')); return alert(this.get_label('enigma.passwordsdiffer'));
if (user.match(/^<[^>]+>$/)) if (user.match(/^<[^>]+>$/))
return alert(this.gettext('enigma.nonameident')); return alert(this.get_label('enigma.nonameident'));
// generate keys // generate keys
// use OpenPGP.js if browser supports required features // use OpenPGP.js if browser supports required features
@ -109,7 +109,7 @@ rcube_webmail.prototype.enigma_key_create_save = function()
}).catch(function(error) { }).catch(function(error) {
// failure // failure
rcmail.set_busy(false, null, lock); 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 // generate keys on the server
@ -119,7 +119,7 @@ rcube_webmail.prototype.enigma_key_create_save = function()
rcmail.http_post('plugin.enigmakeys', options, lock); rcmail.http_post('plugin.enigmakeys', options, lock);
} }
else { 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>') link = $('<span class="blockquote-link"></span>')
.css({position: 'absolute', 'z-Index': 2}) .css({position: 'absolute', 'z-Index': 2})
.text(rcmail.gettext('hide_blockquote.show')) .text(rcmail.get_label('hide_blockquote.show'))
.data('parent', div) .data('parent', div)
.click(function() { .click(function() {
var t = $(this), parent = t.data('parent'), visible = parent.is(':visible'); 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); .detach().appendTo(visible ? q : parent);
parent[visible ? 'hide' : 'show'](); parent[visible ? 'hide' : 'show']();

@ -983,7 +983,7 @@ rcube_webmail.prototype.managesieve_create = function(force)
} }
// build dialog window content // 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) for (i in this.env.sieve_headers)
html += '<li><input type="checkbox" name="headers[]" id="sievehdr'+i+'" value="'+i+'" checked="checked" />' 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>'; +'<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); dialog.html(html);
// [Next Step] button action // [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 // check if there's at least one checkbox checked
var hdrs = $('input[name="headers[]"]:checked', dialog); var hdrs = $('input[name="headers[]"]:checked', dialog);
if (!hdrs.length) { if (!hdrs.length) {
alert(rcmail.gettext('managesieve.nodata')); alert(rcmail.get_label('managesieve.nodata'));
return; return;
} }
@ -1016,7 +1016,7 @@ rcube_webmail.prototype.managesieve_create = function(force)
// Change [Next Step] button with [Save] button // Change [Next Step] button with [Save] button
buttons = {}; buttons = {};
buttons[rcmail.gettext('save')] = function() { buttons[rcmail.get_label('save')] = function() {
var win = $('iframe', dialog).get(0).contentWindow; var win = $('iframe', dialog).get(0).contentWindow;
win.rcmail.managesieve_save(); win.rcmail.managesieve_save();
}; };
@ -1028,7 +1028,7 @@ rcube_webmail.prototype.managesieve_create = function(force)
modal: false, modal: false,
resizable: true, resizable: true,
closeOnEscape: !bw.ie7, // disable for performance reasons closeOnEscape: !bw.ie7, // disable for performance reasons
title: this.gettext('managesieve.newfilter'), title: this.get_label('managesieve.newfilter'),
close: function() { rcmail.managesieve_dialog_close(); }, close: function() { rcmail.managesieve_dialog_close(); },
buttons: buttons, buttons: buttons,
minWidth: 600, minWidth: 600,

@ -18,13 +18,13 @@
*/ */
if (window.rcmail && rcmail.env.task == 'mail') { if (window.rcmail && rcmail.env.task == 'mail') {
rcmail.addEventListener('plugin.newmail_notifier', newmail_notifier_run); rcmail.addEventListener('plugin.newmail_notifier', newmail_notifier_run)
rcmail.addEventListener('actionbefore', newmail_notifier_stop); .addEventListener('actionbefore', newmail_notifier_stop)
rcmail.addEventListener('init', function() { .addEventListener('init', function() {
// bind to messages list select event, so favicon will be reverted on message preview too // bind to messages list select event, so favicon will be reverted on message preview too
if (rcmail.message_list) if (rcmail.message_list)
rcmail.message_list.addEventListener('select', newmail_notifier_stop); rcmail.message_list.addEventListener('select', newmail_notifier_stop);
}); });
} }
// Executes notification methods // Executes notification methods
@ -35,7 +35,7 @@ function newmail_notifier_run(prop)
if (prop.sound) if (prop.sound)
newmail_notifier_sound(); newmail_notifier_sound();
if (prop.desktop) if (prop.desktop)
newmail_notifier_desktop(rcmail.gettext('body', 'newmail_notifier')); newmail_notifier_desktop(rcmail.get_label('body', 'newmail_notifier'));
} }
// Stops notification // Stops notification
@ -76,7 +76,7 @@ function newmail_notifier_basic()
// Add IE icon overlay if we're pinned to Taskbar // Add IE icon overlay if we're pinned to Taskbar
try { try {
if (window.external.msIsSiteMode()) { 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) {} } catch(e) {}
} }
@ -118,7 +118,7 @@ function newmail_notifier_desktop(body)
// https://code.google.com/p/chromium/issues/detail?id=163226 // https://code.google.com/p/chromium/issues/detail?id=163226
try { try {
if (Notification.permission == 'granted' || Notification.permission == undefined) { 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", dir: "auto",
lang: "", lang: "",
body: body, body: body,
@ -139,7 +139,7 @@ function newmail_notifier_desktop(body)
if (rcmail.newmail_popup) if (rcmail.newmail_popup)
rcmail.newmail_popup.cancel(); rcmail.newmail_popup.cancel();
var popup = window.webkitNotifications.createNotification(icon, var popup = window.webkitNotifications.createNotification(icon,
rcmail.gettext('title', 'newmail_notifier'), body); rcmail.get_label('title', 'newmail_notifier'), body);
popup.onclick = function() { popup.onclick = function() {
this.cancel(); this.cancel();
} }
@ -154,7 +154,7 @@ function newmail_notifier_desktop(body)
function newmail_notifier_test_desktop() 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) // W3C draft implementation (with fix for Chrome/Chromium)
try { try {
@ -171,12 +171,12 @@ function newmail_notifier_test_desktop()
else else
dn.requestPermission(function() { dn.requestPermission(function() {
if (!newmail_notifier_desktop(txt)) 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 else
// Everything fails, means the browser has no support // 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() { function newmail_notifier_desktop_authorize() {
Notification.requestPermission(function(perm) { Notification.requestPermission(function(perm) {
if (perm == 'denied') 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') if (perm == 'granted')
newmail_notifier_test_desktop(); // Test again, which should show test message 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'); input_confpasswd = rcube_find_object('_confpasswd');
if (input_curpasswd && input_curpasswd.value == '') { if (input_curpasswd && input_curpasswd.value == '') {
alert(rcmail.gettext('nocurpassword', 'password')); alert(rcmail.get_label('nocurpassword', 'password'));
input_curpasswd.focus(); input_curpasswd.focus();
} }
else if (input_newpasswd && input_newpasswd.value == '') { else if (input_newpasswd && input_newpasswd.value == '') {
alert(rcmail.gettext('nopassword', 'password')); alert(rcmail.get_label('nopassword', 'password'));
input_newpasswd.focus(); input_newpasswd.focus();
} }
else if (input_confpasswd && input_confpasswd.value == '') { else if (input_confpasswd && input_confpasswd.value == '') {
alert(rcmail.gettext('nopassword', 'password')); alert(rcmail.get_label('nopassword', 'password'));
input_confpasswd.focus(); input_confpasswd.focus();
} }
else if (input_newpasswd && input_confpasswd && input_newpasswd.value != input_confpasswd.value) { 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(); input_newpasswd.focus();
} }
else { else {

@ -1,16 +1,18 @@
/* Show user-info plugin script */ /* Show user-info plugin script */
if (window.rcmail) { 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> // <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 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); $('<a>').attr('href', rcmail.env.comm_path + '&_action=plugin.userinfo')
button.click(function(e) { return rcmail.command('plugin.userinfo', this); }); .text(rcmail.get_label('userinfo', 'userinfo'))
.click(function(e) { return rcmail.command('plugin.userinfo', '', this, e); })
.appendTo(tab);
// add button and register command // add button and register command
rcmail.add_element(tab, 'tabs'); 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); link.html('').append(span);
} }
span.text(rcmail.gettext('zipdownload.download')); span.text(rcmail.get_label('zipdownload.download'));
rcmail.env.download_link = link; rcmail.env.download_link = link;
}); });
}); });

@ -4314,7 +4314,7 @@ function rcube_webmail()
'<textarea name="text" id="ffresponsetext" cols="40" rows="8"></textarea></div>' + '<textarea name="text" id="ffresponsetext" cols="40" rows="8"></textarea></div>' +
'</form>'; '</form>';
buttons[this.gettext('save')] = function(e) { buttons[this.get_label('save')] = function(e) {
var name = $('#ffresponsename').val(), var name = $('#ffresponsename').val(),
text = $('#ffresponsetext').val(); text = $('#ffresponsetext').val();
@ -4330,11 +4330,11 @@ function rcube_webmail()
$(this).dialog('close'); $(this).dialog('close');
}; };
buttons[this.gettext('cancel')] = function() { buttons[this.get_label('cancel')] = function() {
$(this).dialog('close'); $(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); $('#ffresponsetext').val(text);
$('#ffresponsename').select(); $('#ffresponsename').select();
@ -5570,7 +5570,7 @@ function rcube_webmail()
// add link to pop back to parent group // add link to pop back to parent group
if (this.env.address_group_stack.length > 1) { if (this.env.address_group_stack.length > 1) {
$('<a href="#list">...</a>') $('<a href="#list">...</a>')
.attr('title', this.gettext('uponelevel')) .attr('title', this.get_label('uponelevel'))
.addClass('poplink') .addClass('poplink')
.appendTo(boxtitle) .appendTo(boxtitle)
.click(function(e){ return ref.command('popgroup','',this); }); .click(function(e){ return ref.command('popgroup','',this); });
@ -8409,7 +8409,7 @@ function rcube_webmail()
if (uri = e.dataTransfer.getData('roundcube-uri')) { if (uri = e.dataTransfer.getData('roundcube-uri')) {
var ts = new Date().getTime(), var ts = new Date().getTime(),
// jQuery way to escape filename (#1490530) // 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._uri = uri;
args._uploadid = ts; args._uploadid = ts;

@ -591,7 +591,7 @@ function rcube_text_editor(config, id)
// open image selector dialog // open image selector dialog
dialog = this.editor.windowManager.open({ dialog = this.editor.windowManager.open({
title: rcmail.gettext('select' + type), title: rcmail.get_label('select' + type),
width: 500, width: 500,
height: 300, height: 300,
html: '<div id="image-selector-list"><ul></ul></div>' 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())); .text($('div.hint', rcmail.gui_objects.uploadform).text()));
// init upload button // 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(); cancel = elem.parents('.mce-panel').find('button:last').parent();
// we need custom Tab key handlers, until we find out why // we need custom Tab key handlers, until we find out why

Loading…
Cancel
Save