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
|
@ -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…
Add table
Add a link
Reference in a new issue