Automatically localize the first argument of display_message()

pull/6144/head
Aleksander Machniak 7 years ago
parent f2b64779cc
commit 39a6c69a3d

@ -1999,7 +1999,7 @@ function rcube_webmail()
// detect popup blocker (#1489618) // detect popup blocker (#1489618)
// don't care this might not work with all browsers // don't care this might not work with all browsers
if (!extwin || extwin.closed) { if (!extwin || extwin.closed) {
this.display_message(this.get_label('windowopenerror'), 'warning'); this.display_message('windowopenerror', 'warning');
return; return;
} }
@ -3090,7 +3090,7 @@ function rcube_webmail()
return; return;
// send request to server // send request to server
this.http_post('copy', post_data, this.display_message(this.get_label('copyingmessage'), 'loading')); this.http_post('copy', post_data, this.display_message('copyingmessage', 'loading'));
}; };
// move selected messages to the specified mailbox // move selected messages to the specified mailbox
@ -3211,7 +3211,7 @@ function rcube_webmail()
if (!lock) { if (!lock) {
msg = action == 'move' ? 'movingmessage' : 'deletingmessage'; msg = action == 'move' ? 'movingmessage' : 'deletingmessage';
lock = this.display_message(this.get_label(msg), 'loading'); lock = this.display_message(msg, 'loading');
} }
// send request to server // send request to server
@ -3300,7 +3300,7 @@ function rcube_webmail()
{ {
var i, len = a_uids.length, var i, len = a_uids.length,
post_data = this.selection_post_data({_uid: this.uids_to_list(a_uids), _flag: flag}), post_data = this.selection_post_data({_uid: this.uids_to_list(a_uids), _flag: flag}),
lock = this.display_message(this.get_label('markingmessage'), 'loading'); lock = this.display_message('markingmessage', 'loading');
// mark all message rows as read/unread // mark all message rows as read/unread
for (i=0; i<len; i++) for (i=0; i<len; i++)
@ -3314,7 +3314,7 @@ function rcube_webmail()
{ {
var i, len = a_uids.length, var i, len = a_uids.length,
post_data = this.selection_post_data({_uid: this.uids_to_list(a_uids), _flag: flag}), post_data = this.selection_post_data({_uid: this.uids_to_list(a_uids), _flag: flag}),
lock = this.display_message(this.get_label('markingmessage'), 'loading'); lock = this.display_message('markingmessage', 'loading');
// mark all message rows as flagged/unflagged // mark all message rows as flagged/unflagged
for (i=0; i<len; i++) for (i=0; i<len; i++)
@ -3359,7 +3359,7 @@ function rcube_webmail()
{ {
var i, len = a_uids.length, var i, len = a_uids.length,
post_data = this.selection_post_data({_uid: this.uids_to_list(a_uids), _flag: 'undelete'}), post_data = this.selection_post_data({_uid: this.uids_to_list(a_uids), _flag: 'undelete'}),
lock = this.display_message(this.get_label('markingmessage'), 'loading'); lock = this.display_message('markingmessage', 'loading');
for (i=0; i<len; i++) for (i=0; i<len; i++)
this.set_message(a_uids[i], 'deleted', false); this.set_message(a_uids[i], 'deleted', false);
@ -3371,7 +3371,7 @@ function rcube_webmail()
{ {
var r_uids = [], var r_uids = [],
post_data = this.selection_post_data({_uid: this.uids_to_list(a_uids), _flag: 'delete'}), post_data = this.selection_post_data({_uid: this.uids_to_list(a_uids), _flag: 'delete'}),
lock = this.display_message(this.get_label('markingmessage'), 'loading'), lock = this.display_message('markingmessage', 'loading'),
list = this.message_list, list = this.message_list,
rows = list ? list.rows : {}, rows = list ? list.rows : {},
count = 0; count = 0;
@ -3584,7 +3584,7 @@ function rcube_webmail()
} }
// load pgp/mime message and pass it to the mailvelope display container // load pgp/mime message and pass it to the mailvelope display container
else if (this.env.pgp_mime_part) { else if (this.env.pgp_mime_part) {
var msgid = this.display_message(this.get_label('loadingdata'), 'loading'), var msgid = this.display_message('loadingdata', 'loading'),
selector = this.env.pgp_mime_container; selector = this.env.pgp_mime_container;
$.ajax({ $.ajax({
@ -3851,7 +3851,7 @@ function rcube_webmail()
// query with publickey.js // query with publickey.js
var deferreds = [], var deferreds = [],
pk = new PublicKey(), pk = new PublicKey(),
lock = ref.display_message(ref.get_label('loading'), 'loading'); lock = ref.display_message('', 'loading');
$.each(emails, function(i, email) { $.each(emails, function(i, email) {
var d = $.Deferred(); var d = $.Deferred();
@ -3966,14 +3966,14 @@ function rcube_webmail()
var btn = $(this), var btn = $(this),
keyid = btn.attr('rel'), keyid = btn.attr('rel'),
pk = new PublicKey(), pk = new PublicKey(),
lock = ref.display_message(ref.get_label('loading'), 'loading'); lock = ref.display_message('', 'loading');
// fetch from keyserver and import to Mailvelope keyring // fetch from keyserver and import to Mailvelope keyring
pk.get(keyid, function(armored, errorCode) { pk.get(keyid, function(armored, errorCode) {
ref.hide_message(lock); ref.hide_message(lock);
if (errorCode) { if (errorCode) {
ref.display_message(ref.get_label('keyservererror'), 'error'); ref.display_message('keyservererror', 'error');
return; return;
} }
@ -4112,7 +4112,7 @@ function rcube_webmail()
}); });
// send the request // send the request
this.http_post('mark', post_data, this.display_message(this.get_label('markingmessage'), 'loading')); this.http_post('mark', post_data, this.display_message('markingmessage', 'loading'));
}; };
// Enable/disable mark-all-read action depending on folders state // Enable/disable mark-all-read action depending on folders state
@ -4442,7 +4442,7 @@ function rcube_webmail()
// register timer to notify about connection timeout // register timer to notify about connection timeout
this.submit_timer = setTimeout(function(){ this.submit_timer = setTimeout(function(){
ref.set_busy(false, null, msgid); ref.set_busy(false, null, msgid);
ref.display_message(ref.get_label('requesttimedout'), 'error'); ref.display_message('requesttimedout', 'error');
}, this.env.request_timeout * 1000); }, this.env.request_timeout * 1000);
form.submit(); form.submit();
@ -4672,7 +4672,7 @@ function rcube_webmail()
this.insert_response = function(key) this.insert_response = function(key)
{ {
this.editor.replace(this.env.textresponses[key]); this.editor.replace(this.env.textresponses[key]);
this.display_message(rcmail.gettext('responseinserted'), 'confirmation'); this.display_message('responseinserted', 'confirmation');
}; };
/** /**
@ -4700,7 +4700,7 @@ function rcube_webmail()
if (!name) if (!name)
name = text.replace(/[\r\n]+/g, ' ').substring(0,40); name = text.replace(/[\r\n]+/g, ' ').substring(0,40);
var lock = ref.display_message(ref.get_label('savingresponse'), 'loading'); var lock = ref.display_message('savingresponse', 'loading');
ref.http_post('settings/responses', { _insert:1, _name:name, _text:text }, lock); ref.http_post('settings/responses', { _insert:1, _name:name, _text:text }, lock);
$(this).dialog('close'); $(this).dialog('close');
}; };
@ -5052,7 +5052,7 @@ function rcube_webmail()
this.editor.change_signature(id, show_sig); this.editor.change_signature(id, show_sig);
if (show && got_sig) if (show && got_sig)
this.display_message(rcmail.gettext('siginserted'), 'confirmation'); this.display_message('siginserted', 'confirmation');
this.env.identity = id; this.env.identity = id;
this.triggerEvent('change_identity'); this.triggerEvent('change_identity');
@ -5116,7 +5116,7 @@ function rcube_webmail()
if (!content.match(/add2attachment/) && (!bw.opera || (ref.env.uploadframe && ref.env.uploadframe == e.data.ts))) { if (!content.match(/add2attachment/) && (!bw.opera || (ref.env.uploadframe && ref.env.uploadframe == e.data.ts))) {
if (!content.match(/display_message/)) if (!content.match(/display_message/))
ref.display_message(ref.get_label('fileuploaderror'), 'error'); ref.display_message('fileuploaderror', 'error');
ref.remove_from_attachment_list(e.data.ts); ref.remove_from_attachment_list(e.data.ts);
if (lock) if (lock)
@ -5644,8 +5644,7 @@ function rcube_webmail()
if (q.length && q.length < min) { if (q.length && q.length < min) {
if (!this.ksearch_info) { if (!this.ksearch_info) {
this.ksearch_info = this.display_message( this.ksearch_info = this.display_message(this.get_label('autocompletechars').replace('$min', min));
this.get_label('autocompletechars').replace('$min', min));
} }
return; return;
} }
@ -5668,7 +5667,7 @@ function rcube_webmail()
threads: props && props.threads ? props.threads : 1, threads: props && props.threads ? props.threads : 1,
action: props && props.action ? props.action : 'mail/autocomplete', action: props && props.action ? props.action : 'mail/autocomplete',
postdata: { _search:q, _source:'%s' }, postdata: { _search:q, _source:'%s' },
lock: this.display_message(this.get_label('searching'), 'loading') lock: this.display_message('searching', 'loading')
}); });
this.ksearch_data = { id:reqid, sources:sources.slice(), num:sources.length }; this.ksearch_data = { id:reqid, sources:sources.slice(), num:sources.length };
@ -6110,8 +6109,7 @@ function rcube_webmail()
if (what != 'add') if (what != 'add')
what = 'del'; what = 'del';
var label = this.get_label(what == 'add' ? 'addingmember' : 'removingmember'), var lock = this.display_message(what == 'add' ? 'addingmember' : 'removingmember', 'loading'),
lock = this.display_message(label, 'loading'),
post_data = {_cid: cid, _source: source, _gid: gid}; post_data = {_cid: cid, _source: source, _gid: gid};
this.http_post('group-'+what+'members', post_data, lock); this.http_post('group-'+what+'members', post_data, lock);
@ -6170,14 +6168,14 @@ function rcube_webmail()
if (dest == source) if (dest == source)
return; return;
var lock = this.display_message(this.get_label('copyingcontact'), 'loading'), var lock = this.display_message('copyingcontact', 'loading'),
post_data = {_cid: cid, _source: this.env.source, _to: dest, _togid: to.id, _gid: group}; post_data = {_cid: cid, _source: this.env.source, _to: dest, _togid: to.id, _gid: group};
this.http_post('copy', post_data, lock); this.http_post('copy', post_data, lock);
} }
// target is an addressbook // target is an addressbook
else if (to.id != source) { else if (to.id != source) {
var lock = this.display_message(this.get_label('copyingcontact'), 'loading'), var lock = this.display_message('copyingcontact', 'loading'),
post_data = {_cid: cid, _source: this.env.source, _to: to.id, _gid: group}; post_data = {_cid: cid, _source: this.env.source, _to: to.id, _gid: group};
this.http_post('copy', post_data, lock); this.http_post('copy', post_data, lock);
@ -6238,7 +6236,7 @@ function rcube_webmail()
var n, a_cids = [], var n, a_cids = [],
label = action == 'delete' ? 'contactdeleting' : 'movingcontact', label = action == 'delete' ? 'contactdeleting' : 'movingcontact',
lock = this.display_message(this.get_label(label), 'loading'); lock = this.display_message(label, 'loading');
if (this.env.cid) if (this.env.cid)
a_cids.push(this.env.cid); a_cids.push(this.env.cid);
@ -7387,7 +7385,7 @@ function rcube_webmail()
this.subscribe = function(folder) this.subscribe = function(folder)
{ {
if (folder) { if (folder) {
var lock = this.display_message(this.get_label('foldersubscribing'), 'loading'); var lock = this.display_message('foldersubscribing', 'loading');
this.http_post('subscribe', {_mbox: folder}, lock); this.http_post('subscribe', {_mbox: folder}, lock);
} }
}; };
@ -7395,7 +7393,7 @@ function rcube_webmail()
this.unsubscribe = function(folder) this.unsubscribe = function(folder)
{ {
if (folder) { if (folder) {
var lock = this.display_message(this.get_label('folderunsubscribing'), 'loading'); var lock = this.display_message('folderunsubscribing', 'loading');
this.http_post('unsubscribe', {_mbox: folder}, lock); this.http_post('unsubscribe', {_mbox: folder}, lock);
} }
}; };
@ -7657,6 +7655,9 @@ function rcube_webmail()
if (!type) if (!type)
type = 'notice'; type = 'notice';
if (msg && msg.length && /^[a-z.]+$/.test(msg))
msg = this.get_label(msg);
if (!key) if (!key)
key = this.html_identifier(msg); key = this.html_identifier(msg);
@ -8205,7 +8206,7 @@ function rcube_webmail()
// fetch headers only once // fetch headers only once
if (!this.gui_objects.all_headers_box.innerHTML) { if (!this.gui_objects.all_headers_box.innerHTML) {
this.http_request('headers', {_uid: this.env.uid, _mbox: this.env.mailbox}, this.http_request('headers', {_uid: this.env.uid, _mbox: this.env.mailbox},
this.display_message(this.get_label('loading'), 'loading') this.display_message('', 'loading')
); );
} }
}; };
@ -8961,9 +8962,9 @@ function rcube_webmail()
if (request.status && errmsg) if (request.status && errmsg)
this.display_message(this.get_label('servererror') + ' (' + errmsg + ')', 'error'); this.display_message(this.get_label('servererror') + ' (' + errmsg + ')', 'error');
else if (status == 'timeout') else if (status == 'timeout')
this.display_message(this.get_label('requesttimedout'), 'error'); this.display_message('requesttimedout', 'error');
else if (request.status == 0 && status != 'abort') else if (request.status == 0 && status != 'abort')
this.display_message(this.get_label('connerror'), 'error'); this.display_message('connerror', 'error');
// redirect to url specified in location header if not empty // redirect to url specified in location header if not empty
var location_url = request.getResponseHeader("Location"); var location_url = request.getResponseHeader("Location");
@ -9041,7 +9042,7 @@ function rcube_webmail()
prop._items = $.extend([], prop.items); // copy items prop._items = $.extend([], prop.items); // copy items
if (!prop.lock) if (!prop.lock)
prop.lock = this.display_message(this.get_label('loading'), 'loading'); prop.lock = this.display_message('', 'loading');
// add the request arguments to the jobs pool // add the request arguments to the jobs pool
this.http_request_jobs[reqid] = prop; this.http_request_jobs[reqid] = prop;
@ -9567,7 +9568,7 @@ function rcube_webmail()
if (!nav || (typeof nav.registerProtocolHandler != 'function')) { if (!nav || (typeof nav.registerProtocolHandler != 'function')) {
$(elem).addClass('disabled').click(function() { $(elem).addClass('disabled').click(function() {
ref.display_message(ref.gettext('nosupporterror'), 'error'); ref.display_message('nosupporterror', 'error');
return false; return false;
}); });
} }

Loading…
Cancel
Save