Translation keys

pull/1/head
yflory 5 years ago
parent 2eafb2190c
commit c64adea8ff

@ -127,13 +127,13 @@ define([
} }
} }
_owners[ed] = f || { _owners[ed] = f || {
displayName: 'Unknown user: '+ ed, // XXX displayName: Messages._getKey('owner_unknownUser', [ed]),
notifications: true, notifications: true,
edPublic: ed, edPublic: ed,
}; };
}); });
var msg = pending ? 'Remove a pending owner:' var msg = pending ? Messages.owner_removePendingText
: 'Remove an existing owner:'; // XXX : Messages.owner_removeText
var removeCol = UIElements.getFriendsList(msg, { var removeCol = UIElements.getFriendsList(msg, {
common: common, common: common,
friends: _owners, friends: _owners,
@ -156,7 +156,7 @@ define([
}); });
// When clicking on the remove button, we check the selected users. // When clicking on the remove button, we check the selected users.
// If you try to remove yourself, we'll display an additional warning message // If you try to remove yourself, we'll display an additional warning message
var btnMsg = pending ? 'Remove pending owners' : 'Remove owners'; // XXX var btnMsg = pending ? Messages.owner_removePendingButton : Messages.owner_removeButton;
var removeButton = h('button.no-margin', btnMsg); var removeButton = h('button.no-margin', btnMsg);
$(removeButton).click(function () { $(removeButton).click(function () {
// Check selection // Check selection
@ -170,9 +170,7 @@ define([
return ed; return ed;
}).filter(function (x) { return x; }); }).filter(function (x) { return x; });
NThen(function (waitFor) { NThen(function (waitFor) {
var msg = me ? var msg = me ? Messages.owner_removeMeConfirm : Messages.owner_removeConfirm;
"Are you sure? You're going to give up on your rights, this can't be undone!" :
"Are you sure?"; // XXX
UI.confirm(msg, waitFor(function (yes) { UI.confirm(msg, waitFor(function (yes) {
if (!yes) { if (!yes) {
waitFor.abort(); waitFor.abort();
@ -190,9 +188,11 @@ define([
if (err) { if (err) {
waitFor.abort(); waitFor.abort();
redrawAll(); redrawAll();
return void UI.warn('ERROR' + err); var text = err === "INSUFFICIENT_PERMISSIONS" ? Messages.fm_forbidden
} // XXX : Messages.error;
UI.log('DONE'); // XXX return void UI.warn(text);
}
UI.log(Messages.saved);
})); }));
}).nThen(function (waitFor) { }).nThen(function (waitFor) {
sel.forEach(function (el) { sel.forEach(function (el) {
@ -232,12 +232,11 @@ define([
delete _friends[curve]; delete _friends[curve];
} }
}); });
var addCol = UIElements.getFriendsList('Ask a friend to be an owner.', { var addCol = UIElements.getFriendsList(Messages.owner_addText, {
common: common, common: common,
friends: _friends friends: _friends
}, function () { }, function () {
// XXX onSelect... //console.log(arguments);
console.log(arguments);
}); });
$div2 = $(addCol.div); $div2 = $(addCol.div);
var others2 = addCol.others; var others2 = addCol.others;
@ -251,10 +250,9 @@ define([
order = order ? 'order:'+order : ''; order = order ? 'order:'+order : '';
$(this).removeClass('cp-selected').attr('style', order); $(this).removeClass('cp-selected').attr('style', order);
} }
// XXX onSelect...
}); });
// When clicking on the add button, we get the selected users. // When clicking on the add button, we get the selected users.
var addButton = h('button.no-margin', 'Add owners'); // XXX var addButton = h('button.no-margin', Messages.owner_addButton);
$(addButton).click(function () { $(addButton).click(function () {
// Check selection // Check selection
var $sel = $div2.find('.cp-share-friend.cp-selected'); var $sel = $div2.find('.cp-share-friend.cp-selected');
@ -264,7 +262,7 @@ define([
}).filter(function (x) { return x; }); }).filter(function (x) { return x; });
NThen(function (waitFor) { NThen(function (waitFor) {
var msg = "Are you sure?"; // XXX var msg = Messages.owner_addConfirm;
UI.confirm(msg, waitFor(function (yes) { UI.confirm(msg, waitFor(function (yes) {
if (!yes) { if (!yes) {
waitFor.abort(); waitFor.abort();
@ -282,8 +280,10 @@ define([
if (err) { if (err) {
waitFor.abort(); waitFor.abort();
redrawAll(); redrawAll();
return void UI.warn('ERROR' + err); var text = err === "INSUFFICIENT_PERMISSIONS" ? Messages.fm_forbidden
} // XXX : Messages.error;
return void UI.warn(text);
}
})); }));
}).nThen(function (waitFor) { }).nThen(function (waitFor) {
sel.forEach(function (el) { sel.forEach(function (el) {
@ -309,7 +309,7 @@ define([
}); });
}).nThen(function () { }).nThen(function () {
redrawAll(); redrawAll();
UI.log('DONE'); // XXX UI.log(Messages.saved);
}); });
}); });
$div2.append(h('p', addButton)); $div2.append(h('p', addButton));
@ -354,7 +354,7 @@ define([
]); ]);
var linkButtons = [{ var linkButtons = [{
className: 'cancel', className: 'cancel',
name: 'CLOSE', // XXX existing key? name: Messages.filePicker_close,
onClick: function () {}, onClick: function () {},
keys: [27] keys: [27]
}]; }];
@ -403,7 +403,7 @@ define([
id: 'cp-app-prop-owners', id: 'cp-app-prop-owners',
})); }));
if (owned) { if (owned) {
var manageOwners = h('button.no-margin', 'Manage owners'); // XXX var manageOwners = h('button.no-margin', Messages.owner_openModalButton);
$(manageOwners).click(function () { $(manageOwners).click(function () {
var modal = createOwnerModal(common, data); var modal = createOwnerModal(common, data);
UI.openCustomModal(modal, { UI.openCustomModal(modal, {
@ -3325,7 +3325,6 @@ define([
var name = Util.fixHTML(msg.content.user.displayName) || Messages.anonymous; var name = Util.fixHTML(msg.content.user.displayName) || Messages.anonymous;
var title = Util.fixHTML(msg.content.title); var title = Util.fixHTML(msg.content.title);
Messages.owner_add = '{0} wants you to be an owner of the pad <b>{1}</b>. Do you accept?'; //XXX
var text = Messages._getKey('owner_add', [name, title]); var text = Messages._getKey('owner_add', [name, title]);
var link = h('a', { var link = h('a', {
@ -3382,9 +3381,11 @@ define([
}, function (err, res) { }, function (err, res) {
err = err || (res && res.error); err = err || (res && res.error);
if (err) { if (err) {
return void UI.warn('ERROR ' + err); var text = err === "INSUFFICIENT_PERMISSIONS" ? Messages.fm_forbidden
} // XXX : Messages.error;
UI.log('DONE'); // XXX return void UI.warn(text);
}
UI.log(Messages.saved);
// Send notification to the sender // Send notification to the sender
answer(true); answer(true);

@ -218,7 +218,6 @@ define([
// Display the notification // Display the notification
var name = Util.fixHTML(msg.content.user.displayName) || Messages.anonymous; var name = Util.fixHTML(msg.content.user.displayName) || Messages.anonymous;
var title = Util.fixHTML(msg.content.title); var title = Util.fixHTML(msg.content.title);
Messages.owner_request = '{0} wants you to be an owner of <b>{1}</b>'; // XXX
content.getFormatText = function () { content.getFormatText = function () {
return Messages._getKey('owner_request', [name, title]); return Messages._getKey('owner_request', [name, title]);
}; };
@ -241,8 +240,6 @@ define([
// Display the notification // Display the notification
var name = Util.fixHTML(msg.content.user.displayName) || Messages.anonymous; var name = Util.fixHTML(msg.content.user.displayName) || Messages.anonymous;
var title = Util.fixHTML(msg.content.title); var title = Util.fixHTML(msg.content.title);
Messages.owner_request_accepted = '{0} has accepted your offer to be an owner of <b>{1}</b>'; // XXX
Messages.owner_request_declined = '{0} has declined your offer to be an owner of <b>{1}</b>'; // XXX
var key = 'owner_request_' + (msg.content.answer ? 'accepted' : 'declined'); var key = 'owner_request_' + (msg.content.answer ? 'accepted' : 'declined');
content.getFormatText = function () { content.getFormatText = function () {
return Messages._getKey(key, [name, title]); return Messages._getKey(key, [name, title]);
@ -259,8 +256,6 @@ define([
// Display the notification // Display the notification
var name = Util.fixHTML(msg.content.user.displayName) || Messages.anonymous; var name = Util.fixHTML(msg.content.user.displayName) || Messages.anonymous;
var title = Util.fixHTML(msg.content.title); var title = Util.fixHTML(msg.content.title);
Messages.owner_removed = '{0} has removed your ownership of <b>{1}</b>'; // XXX
Messages.owner_removedPending = '{0} has removed your pending ownership of <b>{1}</b>'; // XXX
var key = 'owner_removed' + (msg.content.pending ? 'Pending' : ''); var key = 'owner_removed' + (msg.content.pending ? 'Pending' : '');
content.getFormatText = function () { content.getFormatText = function () {
return Messages._getKey(key, [name, title]); return Messages._getKey(key, [name, title]);

Loading…
Cancel
Save