TF-1708 Display mailbox name by language selected
(cherry picked from commit babf065fce72e41c2b14e945e91a7fccb91385d4)
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
|
||||
import 'package:core/utils/app_logger.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
extension PresentationMailboxExtension on PresentationMailbox {
|
||||
|
||||
String getDisplayName(BuildContext context) {
|
||||
if (isDefault) {
|
||||
log("PresentationMailboxExtension::getDisplayName:Role: $role | MailboxName: $name");
|
||||
switch(role!.value.toLowerCase()) {
|
||||
case PresentationMailbox.inboxRole:
|
||||
return AppLocalizations.of(context).inboxMailboxDisplayName;
|
||||
case PresentationMailbox.archiveRole:
|
||||
return AppLocalizations.of(context).archiveMailboxDisplayName;
|
||||
case PresentationMailbox.draftsRole:
|
||||
return AppLocalizations.of(context).draftsMailboxDisplayName;
|
||||
case PresentationMailbox.sentRole:
|
||||
return AppLocalizations.of(context).sentMailboxDisplayName;
|
||||
case PresentationMailbox.outboxRole:
|
||||
return AppLocalizations.of(context).outboxMailboxDisplayName;
|
||||
case PresentationMailbox.trashRole:
|
||||
return AppLocalizations.of(context).trashMailboxDisplayName;
|
||||
case PresentationMailbox.spamRole:
|
||||
return AppLocalizations.of(context).spamMailboxDisplayName;
|
||||
case PresentationMailbox.templatesRole:
|
||||
return AppLocalizations.of(context).templatesMailboxDisplayName;
|
||||
}
|
||||
}
|
||||
return name?.name ?? '';
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import 'package:model/mailbox/expand_mode.dart';
|
||||
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||
import 'package:model/mailbox/select_mode.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/domain/extensions/presentation_mailbox_extension.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/extensions/presentation_mailbox_extension.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_actions.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_displayed.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_node.dart';
|
||||
@@ -294,7 +295,7 @@ class MailBoxFolderTileBuilder {
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextOverflowBuilder(
|
||||
(_mailboxNode.item.name?.name ?? ''),
|
||||
_mailboxNode.item.getDisplayName(context),
|
||||
style: TextStyle(
|
||||
fontSize: _mailboxNode.item.isTeamMailboxes ? 16 : 15,
|
||||
color: _mailboxNode.item.isTeamMailboxes ? Colors.black : AppColor.colorNameEmail,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"@@last_modified": "2023-06-28T15:42:36.189236",
|
||||
"@@last_modified": "2023-07-06T18:40:29.349603",
|
||||
"initializing_data": "Initializing data...",
|
||||
"@initializing_data": {
|
||||
"type": "text",
|
||||
@@ -2918,8 +2918,56 @@
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"Connection error": "Connection error",
|
||||
"@Connection error": {
|
||||
"connectionError": "Connection error",
|
||||
"@connectionError": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"inboxMailboxDisplayName": "Inbox",
|
||||
"@inboxMailboxDisplayName": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"sentMailboxDisplayName": "Sent",
|
||||
"@sentMailboxDisplayName": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"outboxMailboxDisplayName": "Outbox",
|
||||
"@outboxMailboxDisplayName": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"spamMailboxDisplayName": "Spam",
|
||||
"@spamMailboxDisplayName": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"draftsMailboxDisplayName": "Drafts",
|
||||
"@draftsMailboxDisplayName": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"trashMailboxDisplayName": "Trash",
|
||||
"@trashMailboxDisplayName": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"templatesMailboxDisplayName": "Templates",
|
||||
"@templatesMailboxDisplayName": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"archiveMailboxDisplayName": "Archive",
|
||||
"@archiveMailboxDisplayName": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
|
||||
@@ -3009,6 +3009,65 @@ class AppLocalizations {
|
||||
}
|
||||
|
||||
String get connectionError {
|
||||
return Intl.message('Connection error');
|
||||
return Intl.message(
|
||||
'Connection error',
|
||||
name: 'connectionError'
|
||||
);
|
||||
}
|
||||
|
||||
String get inboxMailboxDisplayName {
|
||||
return Intl.message(
|
||||
'Inbox',
|
||||
name: 'inboxMailboxDisplayName',
|
||||
);
|
||||
}
|
||||
|
||||
String get sentMailboxDisplayName {
|
||||
return Intl.message(
|
||||
'Sent',
|
||||
name: 'sentMailboxDisplayName',
|
||||
);
|
||||
}
|
||||
|
||||
String get outboxMailboxDisplayName {
|
||||
return Intl.message(
|
||||
'Outbox',
|
||||
name: 'outboxMailboxDisplayName',
|
||||
);
|
||||
}
|
||||
|
||||
String get spamMailboxDisplayName {
|
||||
return Intl.message(
|
||||
'Spam',
|
||||
name: 'spamMailboxDisplayName',
|
||||
);
|
||||
}
|
||||
|
||||
String get draftsMailboxDisplayName {
|
||||
return Intl.message(
|
||||
'Drafts',
|
||||
name: 'draftsMailboxDisplayName',
|
||||
);
|
||||
}
|
||||
|
||||
String get trashMailboxDisplayName {
|
||||
return Intl.message(
|
||||
'Trash',
|
||||
name: 'trashMailboxDisplayName',
|
||||
);
|
||||
}
|
||||
|
||||
String get templatesMailboxDisplayName {
|
||||
return Intl.message(
|
||||
'Templates',
|
||||
name: 'templatesMailboxDisplayName',
|
||||
);
|
||||
}
|
||||
|
||||
String get archiveMailboxDisplayName {
|
||||
return Intl.message(
|
||||
'Archive',
|
||||
name: 'archiveMailboxDisplayName',
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -8,15 +8,24 @@ import 'package:model/mailbox/select_mode.dart';
|
||||
|
||||
class PresentationMailbox with EquatableMixin {
|
||||
|
||||
static const String inboxRole = 'inbox';
|
||||
static const String sentRole = 'sent';
|
||||
static const String trashRole = 'trash';
|
||||
static const String templatesRole= 'templates';
|
||||
static const String outboxRole = 'outbox';
|
||||
static const String draftsRole = 'drafts';
|
||||
static const String spamRole = 'spam';
|
||||
static const String archiveRole = 'archive';
|
||||
|
||||
static final PresentationMailbox unifiedMailbox = PresentationMailbox(MailboxId(Id('unified')));
|
||||
|
||||
static final roleInbox = Role('inbox');
|
||||
static final roleTrash = Role('trash');
|
||||
static final roleSent = Role('sent');
|
||||
static final roleTemplates = Role('templates');
|
||||
static final roleOutbox = Role('outbox');
|
||||
static final roleDrafts = Role('drafts');
|
||||
static final roleSpam = Role('spam');
|
||||
static final roleInbox = Role(inboxRole);
|
||||
static final roleTrash = Role(trashRole);
|
||||
static final roleSent = Role(sentRole);
|
||||
static final roleTemplates = Role(templatesRole);
|
||||
static final roleOutbox = Role(outboxRole);
|
||||
static final roleDrafts = Role(draftsRole);
|
||||
static final roleSpam = Role(spamRole);
|
||||
|
||||
static final outboxMailboxName = MailboxName('Outbox');
|
||||
static final lowerCaseOutboxMailboxName = MailboxName('outbox');
|
||||
|
||||
Reference in New Issue
Block a user