Properly localize group changes (#1802)
* Properly localize group updates * Remove phone number in display name if contact in address book * New string for multiple new group members
This commit is contained in:
parent
87d8ec723a
commit
0a4f984cf5
3 changed files with 48 additions and 6 deletions
|
@ -906,7 +906,7 @@
|
|||
},
|
||||
"leftTheGroup": {
|
||||
"message": "$name$ left the group.",
|
||||
"description": "Shown in the conversation history when someone leaves the group",
|
||||
"description": "Shown in the conversation history when a single person leaves the group",
|
||||
"placeholders": {
|
||||
"name": {
|
||||
"content": "$1",
|
||||
|
@ -929,8 +929,18 @@
|
|||
}
|
||||
},
|
||||
"joinedTheGroup": {
|
||||
"message": "$name$ joined the group.",
|
||||
"description": "Shown in the conversation history when a single person joins the group",
|
||||
"placeholders": {
|
||||
"name": {
|
||||
"content": "$1",
|
||||
"example": "Alice"
|
||||
}
|
||||
}
|
||||
},
|
||||
"multipleJoinedTheGroup": {
|
||||
"message": "$names$ joined the group.",
|
||||
"description": "Shown in the conversation history when people join the group",
|
||||
"description": "Shown in the conversation history when more than one person joins the group",
|
||||
"placeholders": {
|
||||
"names": {
|
||||
"content": "$1",
|
||||
|
|
|
@ -1017,6 +1017,24 @@
|
|||
}
|
||||
},
|
||||
|
||||
getDisplayName: function() {
|
||||
if (!this.isPrivate()) {
|
||||
return this.getTitle();
|
||||
}
|
||||
|
||||
var name = this.get('name');
|
||||
if (name) {
|
||||
return name;
|
||||
}
|
||||
|
||||
var profileName = this.get('profileName');
|
||||
if (profileName) {
|
||||
return this.getNumber() + ' ~' + profileName;
|
||||
}
|
||||
|
||||
return this.getNumber();
|
||||
},
|
||||
|
||||
getNumber: function() {
|
||||
if (!this.isPrivate()) {
|
||||
return '';
|
||||
|
|
|
@ -72,19 +72,33 @@
|
|||
return this.sync('read', this, options);
|
||||
},
|
||||
// jscs:enable
|
||||
getNameForNumber: function(number) {
|
||||
var conversation = ConversationController.get(number);
|
||||
if (!conversation) {
|
||||
return number;
|
||||
}
|
||||
return conversation.getDisplayName();
|
||||
},
|
||||
getDescription: function() {
|
||||
if (this.isGroupUpdate()) {
|
||||
var group_update = this.get('group_update');
|
||||
if (group_update.left) {
|
||||
return i18n('leftTheGroup', group_update.left);
|
||||
if (group_update.left === 'You') {
|
||||
return i18n('youLeftTheGroup');
|
||||
} else if (group_update.left) {
|
||||
return i18n('leftTheGroup', this.getNameForNumber(group_update.left));
|
||||
}
|
||||
|
||||
var messages = [i18n('updatedTheGroup')];
|
||||
if (group_update.name) {
|
||||
messages.push(i18n('titleIsNow', group_update.name));
|
||||
}
|
||||
if (group_update.joined) {
|
||||
messages.push(i18n('joinedTheGroup', group_update.joined.join(', ')));
|
||||
if (group_update.joined && group_update.joined.length) {
|
||||
var names = _.map(group_update.joined, this.getNameForNumber.bind(this));
|
||||
if (names.length > 1) {
|
||||
messages.push(i18n('multipleJoinedTheGroup', names.join(', ')));
|
||||
} else {
|
||||
messages.push(i18n('joinedTheGroup', names[0]));
|
||||
}
|
||||
}
|
||||
|
||||
return messages.join(' ');
|
||||
|
|
Loading…
Reference in a new issue