Add translation keys and remove/fix XXX

pull/1/head
yflory 5 years ago
parent b3041bd59a
commit d90115fbc9

File diff suppressed because it is too large Load Diff

@ -771,7 +771,7 @@ define([
id: id id: id
}; };
}); });
var teamsList = UIElements.getFriendsList('Share with a team', { // XXX var teamsList = UIElements.getFriendsList(Messages.share_linkTeam, {
common: common, common: common,
noFilter: true, noFilter: true,
friends: teams friends: teams
@ -1182,7 +1182,7 @@ define([
var hasFriends = Object.keys(config.friends || {}).length !== 0; var hasFriends = Object.keys(config.friends || {}).length !== 0;
if (!hasFriends) { if (!hasFriends) {
return void UI.alert('No friend to invite'); // XXX return void UI.alert(Messages.team_noFriend);
} }
var privateData = common.getMetadataMgr().getPrivateData(); var privateData = common.getMetadataMgr().getPrivateData();
var team = privateData.teams[config.teamId]; var team = privateData.teams[config.teamId];
@ -1203,7 +1203,7 @@ define([
$btn.prop('disabled', 'disabled'); $btn.prop('disabled', 'disabled');
} }
}; };
var list = UIElements.getFriendsList('Pick the friends you want to invite to the team', { // XXX var list = UIElements.getFriendsList(Messages.team_pickFriends, {
common: common, common: common,
friends: config.friends, friends: config.friends,
}, refreshButton); }, refreshButton);
@ -1217,7 +1217,7 @@ define([
keys: [27] keys: [27]
}, { }, {
className: 'primary', className: 'primary',
name: 'INVITE', // XXX name: Messages.team_inviteModalButton,
onClick: function () { onClick: function () {
var $sel = $div.find('.cp-share-friend.cp-selected'); var $sel = $div.find('.cp-share-friend.cp-selected');
var sel = $sel.toArray(); var sel = $sel.toArray();
@ -2895,7 +2895,7 @@ define([
'data-value': teamId, 'data-value': teamId,
'href': '#' 'href': '#'
}, },
content: 'TEAM: <b>' + t.name + '</b>' // XXX content: Messages._getKey('team_pcsSelectEntry', [Util.fixHTML(t.name)])
}; };
}); });
teamOptions.unshift({ teamOptions.unshift({
@ -2926,9 +2926,9 @@ define([
$teamBlock.setValue(id); $teamBlock.setValue(id);
}); });
team = h('div.cp-creation-team', [ team = h('div.cp-creation-team', [
'Store in', // XXX Messages.team_pcsSelectLabel,
$teamBlock[0], $teamBlock[0],
createHelper('#', "The pad will be stored in your team's drive. If this is an owned pad, it will be owned by the team.") // XXX createHelper('#', Messages.team_pcsSelectHelp)
]); ]);
if (privateData.storeInTeam) { if (privateData.storeInTeam) {
$teamBlock.setValue(privateData.storeInTeam); $teamBlock.setValue(privateData.storeInTeam);
@ -3717,8 +3717,7 @@ define([
var verified = UIElements.getVerifiedFriend(common, msg.author, name); var verified = UIElements.getVerifiedFriend(common, msg.author, name);
//var text = Messages._getKey('', [name, title]); // XXX var text = Messages._getKey('team_invitedToTeam', [name, teamName]);
var text = name + " has invited you to join the team <b>" + teamName +"</b>";
var div = h('div', [ var div = h('div', [
UI.setHTML(h('p'), text), UI.setHTML(h('p'), text),

@ -716,7 +716,7 @@ define([
if (room.isFriendChat) { if (room.isFriendChat) {
$parentEl = $userlist.find('.cp-app-contacts-friends'); $parentEl = $userlist.find('.cp-app-contacts-friends');
} else if (room.isTeamChat) { } else if (room.isTeamChat) {
$parentEl = $userlist.find('.cp-app-contacts-padchat'); // XXX $parentEl = $userlist.find('.cp-app-contacts-padchat');
} else if (room.isPadChat) { } else if (room.isPadChat) {
$parentEl = $userlist.find('.cp-app-contacts-padchat'); $parentEl = $userlist.find('.cp-app-contacts-padchat');
} else { } else {
@ -829,7 +829,7 @@ define([
return void console.error('Invalid team chat'); return void console.error('Invalid team chat');
} }
var room = rooms[0]; var room = rooms[0];
room.name = 'TEAMS'; // XXX room.name = Messages.type.team;
rooms.forEach(initializeRoom); rooms.forEach(initializeRoom);
}); });
}; };

@ -261,8 +261,7 @@ define([
var name = Util.fixHTML(msg.content.user.displayName) || Messages.anonymous; var name = Util.fixHTML(msg.content.user.displayName) || Messages.anonymous;
var teamName = Util.fixHTML(Util.find(msg, ['content', 'team', 'metadata', 'name']) || ''); var teamName = Util.fixHTML(Util.find(msg, ['content', 'team', 'metadata', 'name']) || '');
content.getFormatText = function () { content.getFormatText = function () {
var text = name + " has invited you to join the team <b>" + teamName +"</b>"; var text = Messages._getKey('team_invitedToTeam', [name, teamName]);
// XXX
return text; return text;
}; };
if (!content.archived) { if (!content.archived) {
@ -280,8 +279,7 @@ define([
var name = Util.fixHTML(msg.content.user.displayName) || Messages.anonymous; var name = Util.fixHTML(msg.content.user.displayName) || Messages.anonymous;
var teamName = Util.fixHTML(Util.find(msg, ['content', 'teamName']) || ''); var teamName = Util.fixHTML(Util.find(msg, ['content', 'teamName']) || '');
content.getFormatText = function () { content.getFormatText = function () {
var text = name + " has kicked you from join the team <b>" + teamName +"</b>"; var text = Messages._getKey('team_kickedFromTeam', [name, teamName]);
// XXX
return text; return text;
}; };
if (!content.archived) { if (!content.archived) {
@ -296,10 +294,9 @@ 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 teamName = Util.fixHTML(Util.find(msg, ['content', 'team', 'metadata', 'name']) || ''); var teamName = Util.fixHTML(Util.find(msg, ['content', 'team', 'metadata', 'name']) || '');
//var key = 'owner_request_' + (msg.content.answer ? 'accepted' : 'declined'); var key = 'team_' + (msg.content.answer ? 'accept' : 'decline') + 'Invitation';
content.getFormatText = function () { content.getFormatText = function () {
//return Messages._getKey(key, [name, title]); // XXX return Messages._getKey(key, [name, teamName]);
return name +' has ' + (msg.content.answer ? 'accepted' : 'declined') + ' your offer to join the team <b>' + teamName + '</b>';
}; };
if (!content.archived) { if (!content.archived) {
content.dismissHandler = defaultDismiss(common, data); content.dismissHandler = defaultDismiss(common, data);

@ -446,7 +446,7 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto) {
// deleted while you are open // deleted while you are open
// emit an event // emit an event
var onChannelError = function (info) { var onChannelError = function (info) {
if (!ready) { return void cb(info); } // XXX make sure we don't reconnect if (!ready) { return void cb(info); }
console.error("CHANNEL_ERROR", info); console.error("CHANNEL_ERROR", info);
}; };

@ -173,7 +173,7 @@ define([
showCategories(categories[key]); showCategories(categories[key]);
}); });
$category.append(Messages['team_cat_'+key] || key); // XXX $category.append(Messages['team_cat_'+key] || key);
}); });
if (active === 'drive') { if (active === 'drive') {
APP.$rightside.addClass('cp-rightside-drive'); APP.$rightside.addClass('cp-rightside-drive');
@ -259,8 +259,8 @@ define([
makeBlock('info', function (common, cb) { makeBlock('info', function (common, cb) {
cb([ cb([
h('h3', 'Team application'), // XXX h('h3', Messages.team_infoLabel),
h('p', 'From here you can ...') // XXX h('p', Messages.team_infoContent)
]); ]);
}); });
@ -274,13 +274,12 @@ define([
var lis = []; var lis = [];
Object.keys(obj).forEach(function (id) { Object.keys(obj).forEach(function (id) {
var team = obj[id]; var team = obj[id];
var a = h('a', 'Open'); var a = h('a', Messages.team_listLoad);
var avatar = h('span.cp-avatar.cp-team-list-avatar'); var avatar = h('span.cp-avatar.cp-team-list-avatar');
lis.push(h('li', h('ul', [ lis.push(h('li', h('ul', [ // XXX UI
h('li', avatar), // XXX h('li', avatar),
h('li', 'Name: ' + team.metadata.name), // XXX h('li', team.metadata.name),
h('li', 'ID: ' + id), // XXX h('li', a)
h('li', a) // XXX
]))); ])));
common.displayAvatar($(avatar), team.metadata.avatar, team.metadata.name); common.displayAvatar($(avatar), team.metadata.avatar, team.metadata.name);
$(a).click(function () { $(a).click(function () {
@ -305,11 +304,11 @@ define([
makeBlock('create', function (common, cb) { makeBlock('create', function (common, cb) {
var content = []; var content = [];
content.push(h('h3', 'Create a team')); // XXX content.push(h('h3', Messages.team_createLabel));
content.push(h('label', 'Team name')); // XXX content.push(h('label', Messages.team_createName));
var input = h('input', {type:'text'}); var input = h('input', {type:'text'});
content.push(input); content.push(input);
var button = h('button.btn.btn-success', 'Create'); // XXX var button = h('button.btn.btn-success', Messages.creation_create);
content.push(h('br')); content.push(h('br'));
content.push(h('br')); content.push(h('br'));
content.push(button); content.push(button);
@ -403,7 +402,7 @@ define([
// If they're a member and I have a higher role than them, I can promote them to admin // If they're a member and I have a higher role than them, I can promote them to admin
if (!isMe && myRole > theirRole && theirRole === 0) { if (!isMe && myRole > theirRole && theirRole === 0) {
var promote = h('span.fa.fa-angle-double-up', { var promote = h('span.fa.fa-angle-double-up', {
title: 'Promote' // XXX title: Messages.team_rosterPromote
}); });
$(promote).click(function () { $(promote).click(function () {
data.role = 'ADMIN'; data.role = 'ADMIN';
@ -416,7 +415,7 @@ define([
// (if they're not already a MEMBER) // (if they're not already a MEMBER)
if (!isMe && myRole >= theirRole && theirRole > 0) { if (!isMe && myRole >= theirRole && theirRole > 0) {
var demote = h('span.fa.fa-angle-double-down', { var demote = h('span.fa.fa-angle-double-down', {
title: 'Demote' // XXX title: Messages.team_rosterDemote
}); });
$(demote).click(function () { $(demote).click(function () {
data.role = ROLES[theirRole - 1] || 'MEMBER'; data.role = ROLES[theirRole - 1] || 'MEMBER';
@ -428,7 +427,7 @@ define([
// If I'm not a member and I have an equal or higher role than them, I can remove them // If I'm not a member and I have an equal or higher role than them, I can remove them
if (!isMe && myRole > 0 && myRole >= theirRole) { if (!isMe && myRole > 0 && myRole >= theirRole) {
var remove = h('span.fa.fa-times', { var remove = h('span.fa.fa-times', {
title: 'Remove' // XXX title: Messages.team_rosterKick
}); });
$(remove).click(function () { $(remove).click(function () {
$(remove).hide(); $(remove).hide();
@ -487,15 +486,14 @@ define([
}).map(function (k) { }).map(function (k) {
return makeMember(common, roster[k], me); return makeMember(common, roster[k], me);
}); });
// XXX LEAVE the team button
// XXX INVITE to the team button
var header = h('div.cp-app-team-roster-header'); var header = h('div.cp-app-team-roster-header');
var $header = $(header); var $header = $(header);
// If you're an admin or an owner, you can invite your friends to the team // If you're an admin or an owner, you can invite your friends to the team
// TODO and acquaintances later? // TODO and acquaintances later?
if (me && (me.role === 'ADMIN' || me.role === 'OWNER')) { if (me && (me.role === 'ADMIN' || me.role === 'OWNER')) {
var invite = h('button.btn.btn-primary', 'INVITE A FRIEND'); var invite = h('button.btn.btn-primary', Messages.team_inviteButton);
var inviteFriends = common.getFriends(); var inviteFriends = common.getFriends();
Object.keys(inviteFriends).forEach(function (curve) { Object.keys(inviteFriends).forEach(function (curve) {
// Keep only friends that are not already in the team and that you can contact // Keep only friends that are not already in the team and that you can contact
@ -517,9 +515,9 @@ define([
} }
if (me && (me.role === 'ADMIN' || me.role === 'MEMBER')) { if (me && (me.role === 'ADMIN' || me.role === 'MEMBER')) {
var leave = h('button.btn.btn-danger', 'LEAVE THE TEAM'); var leave = h('button.btn.btn-danger', Messages.team_leaveButton);
$(leave).click(function () { $(leave).click(function () {
UI.confirm("Your're going to leave this team and lose access to its entire drive. Are you sure?", function (yes) { UI.confirm(Messages.team_leaveConfirm, function (yes) {
if (!yes) { return; } if (!yes) { return; }
APP.module.execCommand('LEAVE_TEAM', { APP.module.execCommand('LEAVE_TEAM', {
teamId: APP.team teamId: APP.team
@ -535,11 +533,11 @@ define([
return [ return [
header, header,
h('h3', 'OWNER'), // XXX h('h3', Messages.team_owner),
h('div', owner), h('div', owner),
h('h3', 'ADMINS'), // XXX h('h3', Messages.team_admins),
h('div', admins), h('div', admins),
h('h3', 'MEMBERS'), // XXX h('h3', Messages.team_members),
h('div', members) h('div', members)
]; ];
}; };
@ -557,7 +555,7 @@ define([
teamId: APP.team teamId: APP.team
}, function (obj) { }, function (obj) {
if (obj && obj.error) { if (obj && obj.error) {
return void UI.alert(Messages.error); // XXX return void UI.alert(Messages.error);
} }
common.setTeamChat(obj.channel); common.setTeamChat(obj.channel);
MessengerUI.create($(container), common, true); MessengerUI.create($(container), common, true);
@ -700,7 +698,7 @@ define([
driveAPP.loggedIn = common.isLoggedIn(); driveAPP.loggedIn = common.isLoggedIn();
if (!driveAPP.loggedIn) { throw new Error('NOT_LOGGED_IN'); } if (!driveAPP.loggedIn) { throw new Error('NOT_LOGGED_IN'); }
common.setTabTitle('TEAMS (ALPHA)'); // XXX common.setTabTitle(Messages.type.team);
// Drive data // Drive data
if (privateData.newSharedFolder) { if (privateData.newSharedFolder) {
@ -712,7 +710,7 @@ define([
var $bar = $('#cp-toolbar'); var $bar = $('#cp-toolbar');
var configTb = { var configTb = {
displayed: ['useradmin', 'pageTitle', 'newpad', 'limit', 'notifications'], displayed: ['useradmin', 'pageTitle', 'newpad', 'limit', 'notifications'],
pageTitle: 'TEAMS (ALPHA)', // XXX pageTitle: Messages.type.team,
metadataMgr: metadataMgr, metadataMgr: metadataMgr,
readOnly: privateData.readOnly, readOnly: privateData.readOnly,
sfCommon: common, sfCommon: common,

Loading…
Cancel
Save