(js) Localize mailbox names everywhere

Fixes #4041
This commit is contained in:
Francis Lachapelle
2017-02-19 21:13:44 -05:00
parent fd13fd632c
commit 48b2008da4
7 changed files with 49 additions and 39 deletions
@@ -157,16 +157,47 @@
*/
Mailbox.prototype.init = function(data) {
var _this = this;
this.$isLoading = true;
this.$messages = [];
this.uidsMap = {};
if (angular.isUndefined(this.$messages)) {
this.$isLoading = true;
this.$messages = [];
this.uidsMap = {};
}
angular.extend(this, data);
if (this.path) {
this.id = this.$id();
this.$acl = new Mailbox.$$Acl('Mail/' + this.id);
}
this.$displayName = this.name;
if (this.type) {
this.$isEditable = this.isEditable();
this.$isSpecial = true;
if (this.type == 'inbox') {
this.$displayName = l('InboxFolderName');
this.$icon = 'inbox';
}
else if (this.type == 'draft') {
this.$displayName = l('DraftsFolderName');
this.$icon = 'drafts';
}
else if (this.type == 'sent') {
this.$displayName = l('SentFolderName');
this.$icon = 'send';
}
else if (this.type == 'trash') {
this.$displayName = l('TrashFolderName');
this.$icon = 'delete';
}
else if (this.type == 'junk') {
this.$displayName = l('JunkFolderName');
this.$icon = 'thumb_down';
}
else if (this.type == 'additional') {
this.$icon = 'folder_shared';
}
else {
this.$isSpecial = false;
this.$icon = 'folder_open';
}
}
this.$isNoInferiors = this.isNoInferiors();
if (angular.isUndefined(this.$shadowData)) {
@@ -58,7 +58,7 @@
var title = defaultWindowTitle + ' - ';
if (unseenCount)
title += '(' + unseenCount + ') ';
title += vm.selectedFolder.name;
title += vm.selectedFolder.$displayName;
$window.document.title = title;
});
@@ -28,7 +28,6 @@
vm.confirmDelete = confirmDelete;
vm.markFolderRead = markFolderRead;
vm.share = share;
vm.metadataForFolder = metadataForFolder;
vm.setFolderAs = setFolderAs;
vm.refreshUnseenCount = refreshUnseenCount;
vm.isDroppableFolder = isDroppableFolder;
@@ -187,7 +186,6 @@
clickOutsideToClose: true,
escapeToClose: true,
locals: {
metadataForFolder: metadataForFolder,
srcAccount: account
}
}).finally(function() {
@@ -197,13 +195,12 @@
/**
* @ngInject
*/
SubscriptionsDialogController.$inject = ['$scope', '$mdDialog', 'metadataForFolder', 'srcAccount'];
function SubscriptionsDialogController($scope, $mdDialog, metadataForFolder, srcAccount) {
SubscriptionsDialogController.$inject = ['$scope', '$mdDialog', 'srcAccount'];
function SubscriptionsDialogController($scope, $mdDialog, srcAccount) {
var vm = this;
vm.loading = true;
vm.filter = { name: '' };
vm.metadataForFolder = metadataForFolder;
vm.account = new Account({
id: srcAccount.id,
name: srcAccount.name
@@ -389,23 +386,6 @@
});
} // share
function metadataForFolder(folder) {
if (folder.type == 'inbox')
return {name: l('InboxFolderName'), icon:'inbox', special: true};
else if (folder.type == 'draft')
return {name: l('DraftsFolderName'), icon: 'drafts', special: true};
else if (folder.type == 'sent')
return {name: l('SentFolderName'), icon: 'send', special: true};
else if (folder.type == 'trash')
return {name: l('TrashFolderName'), icon: 'delete', special: true};
else if (folder.type == 'junk')
return {name: l('JunkFolderName'), icon: 'thumb_down', special: true};
else if (folder.type == 'additional')
return {name: folder.name, icon: 'folder_shared', special: true};
return {name: folder.name, icon: 'folder_open', special: false};
}
function setFolderAs(folder, type) {
folder.$setFolderAs(type).then(function() {
folder.$account.$getMailboxes({reload: true});