TF-4029 Fix singular vs plural for attachments

This commit is contained in:
dab246
2025-09-19 09:58:02 +07:00
committed by Dat H. Pham
parent e75bdad5df
commit 993cdb235a
10 changed files with 95 additions and 11 deletions
@@ -100,7 +100,9 @@ extension ComposerPrintDraftExtension on ComposerController {
ccPrefix: appLocalizations.cc_email_address_prefix, ccPrefix: appLocalizations.cc_email_address_prefix,
bccPrefix: appLocalizations.bcc_email_address_prefix, bccPrefix: appLocalizations.bcc_email_address_prefix,
replyToPrefix: appLocalizations.replyToEmailAddressPrefix, replyToPrefix: appLocalizations.replyToEmailAddressPrefix,
titleAttachment: appLocalizations.attachments.toLowerCase(), titleAttachment: uploadController.allAttachmentsUploaded.length > 1
? appLocalizations.attachments.toLowerCase()
: appLocalizations.attachment.toLowerCase(),
toAddress: listToEmailAddress.toSet().listEmailAddressToString( toAddress: listToEmailAddress.toSet().listEmailAddressToString(
isFullEmailAddress: true, isFullEmailAddress: true,
), ),
@@ -57,7 +57,9 @@ class AttachmentHeaderComposerWidget extends StatelessWidget {
), ),
const SizedBox(width: AttachmentHeaderComposerWidgetStyle.space / 2), const SizedBox(width: AttachmentHeaderComposerWidgetStyle.space / 2),
Text( Text(
'${listFileUploaded.length} ${AppLocalizations.of(context).attachments}', listFileUploaded.length > 1
? '${listFileUploaded.length} ${AppLocalizations.of(context).attachments}'
: '${listFileUploaded.length} ${AppLocalizations.of(context).attachment}',
style: AttachmentHeaderComposerWidgetStyle.labelTextSize style: AttachmentHeaderComposerWidgetStyle.labelTextSize
), ),
const SizedBox(width: AttachmentHeaderComposerWidgetStyle.space), const SizedBox(width: AttachmentHeaderComposerWidgetStyle.space),
@@ -503,7 +503,9 @@ class EmailDataSourceImpl extends EmailDataSource {
ccPrefix: appLocalizations.cc_email_address_prefix, ccPrefix: appLocalizations.cc_email_address_prefix,
bccPrefix: appLocalizations.bcc_email_address_prefix, bccPrefix: appLocalizations.bcc_email_address_prefix,
replyToPrefix: appLocalizations.replyToEmailAddressPrefix, replyToPrefix: appLocalizations.replyToEmailAddressPrefix,
titleAttachment: appLocalizations.attachments.toLowerCase(), titleAttachment: listPreviewAttachment.length > 1
? appLocalizations.attachments.toLowerCase()
: appLocalizations.attachment.toLowerCase(),
attachmentIcon: attachmentIconBase64Data, attachmentIcon: attachmentIconBase64Data,
toAddress: email.to?.listEmailAddressToString(isFullEmailAddress: true), toAddress: email.to?.listEmailAddressToString(isFullEmailAddress: true),
ccAddress: email.cc?.listEmailAddressToString(isFullEmailAddress: true), ccAddress: email.cc?.listEmailAddressToString(isFullEmailAddress: true),
@@ -343,7 +343,9 @@ class EmailLocalStorageDataSourceImpl extends EmailDataSource {
ccPrefix: appLocalizations.cc_email_address_prefix, ccPrefix: appLocalizations.cc_email_address_prefix,
bccPrefix: appLocalizations.bcc_email_address_prefix, bccPrefix: appLocalizations.bcc_email_address_prefix,
replyToPrefix: appLocalizations.replyToEmailAddressPrefix, replyToPrefix: appLocalizations.replyToEmailAddressPrefix,
titleAttachment: appLocalizations.attachments.toLowerCase(), titleAttachment: listPreviewAttachment.length > 1
? appLocalizations.attachments.toLowerCase()
: appLocalizations.attachment.toLowerCase(),
attachmentIcon: attachmentIconBase64Data, attachmentIcon: attachmentIconBase64Data,
toAddress: email.to?.listEmailAddressToString(isFullEmailAddress: true), toAddress: email.to?.listEmailAddressToString(isFullEmailAddress: true),
ccAddress: email.cc?.listEmailAddressToString(isFullEmailAddress: true), ccAddress: email.cc?.listEmailAddressToString(isFullEmailAddress: true),
@@ -408,7 +408,9 @@ class EmailActionReactor {
ccPrefix: appLocalizations.cc_email_address_prefix, ccPrefix: appLocalizations.cc_email_address_prefix,
bccPrefix: appLocalizations.bcc_email_address_prefix, bccPrefix: appLocalizations.bcc_email_address_prefix,
replyToPrefix: appLocalizations.replyToEmailAddressPrefix, replyToPrefix: appLocalizations.replyToEmailAddressPrefix,
titleAttachment: appLocalizations.attachments.toLowerCase(), titleAttachment: emailLoaded.attachments.length > 1
? appLocalizations.attachments.toLowerCase()
: appLocalizations.attachment.toLowerCase(),
toAddress: presentationEmail.to?.listEmailAddressToString(isFullEmailAddress: true), toAddress: presentationEmail.to?.listEmailAddressToString(isFullEmailAddress: true),
ccAddress: presentationEmail.cc?.listEmailAddressToString(isFullEmailAddress: true), ccAddress: presentationEmail.cc?.listEmailAddressToString(isFullEmailAddress: true),
bccAddress: presentationEmail.bcc?.listEmailAddressToString(isFullEmailAddress: true), bccAddress: presentationEmail.bcc?.listEmailAddressToString(isFullEmailAddress: true),
@@ -38,10 +38,15 @@ class AttachmentsInfo extends StatelessWidget {
); );
final titleHeaderAttachment = Text( final titleHeaderAttachment = Text(
AppLocalizations.of(context).titleHeaderAttachment( numberOfAttachments > 1
numberOfAttachments, ? AppLocalizations.of(context).titleHeaderAttachment(
totalSizeInfo, numberOfAttachments,
), totalSizeInfo,
)
: AppLocalizations.of(context).singularAttachmentTitleHeader(
numberOfAttachments,
totalSizeInfo,
),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: ThemeUtils.textStyleInter400.copyWith( style: ThemeUtils.textStyleInter400.copyWith(
+18
View File
@@ -363,6 +363,18 @@
"totalSize": {} "totalSize": {}
} }
}, },
"singularAttachmentTitleHeader": "{count} Attachment ({totalSize})",
"@singularAttachmentTitleHeader": {
"type": "text",
"placeholders_order": [
"count",
"totalSize"
],
"placeholders": {
"count": {},
"totalSize": {}
}
},
"attach_file_prepare_text": "Preparing to attach file...", "attach_file_prepare_text": "Preparing to attach file...",
"@attach_file_prepare_text": { "@attach_file_prepare_text": {
"type": "text", "type": "text",
@@ -787,6 +799,12 @@
"placeholders_order": [], "placeholders_order": [],
"placeholders": {} "placeholders": {}
}, },
"attachment": "Attachment",
"@attachment": {
"type": "text",
"placeholders_order": [],
"placeholders": {}
},
"showAll": "Show all", "showAll": "Show all",
"@showAll": { "@showAll": {
"type": "text", "type": "text",
+18
View File
@@ -654,6 +654,12 @@
"placeholders_order": [], "placeholders_order": [],
"placeholders": {} "placeholders": {}
}, },
"attachment": "Pièce jointe",
"@attachment": {
"type": "text",
"placeholders_order": [],
"placeholders": {}
},
"show_all": "Tout afficher", "show_all": "Tout afficher",
"@show_all": { "@show_all": {
"type": "text", "type": "text",
@@ -2120,6 +2126,18 @@
"totalSize": {} "totalSize": {}
} }
}, },
"singularAttachmentTitleHeader": "{count} Pièce jointe ({totalSize})",
"@singularAttachmentTitleHeader": {
"type": "text",
"placeholders_order": [
"count",
"totalSize"
],
"placeholders": {
"count": {},
"totalSize": {}
}
},
"undo": "Annuler", "undo": "Annuler",
"@undo": { "@undo": {
"type": "text", "type": "text",
+20 -2
View File
@@ -1,5 +1,5 @@
{ {
"@@last_modified": "2025-09-11T12:24:54.969188", "@@last_modified": "2025-09-19T09:56:48.738620",
"initializing_data": "Initializing data...", "initializing_data": "Initializing data...",
"@initializing_data": { "@initializing_data": {
"type": "text", "type": "text",
@@ -390,6 +390,18 @@
"totalSize": {} "totalSize": {}
} }
}, },
"singularAttachmentTitleHeader": "{count} Attachment ({totalSize})",
"@singularAttachmentTitleHeader": {
"type": "text",
"placeholders_order": [
"count",
"totalSize"
],
"placeholders": {
"count": {},
"totalSize": {}
}
},
"attach_file_prepare_text": "Preparing to attach file...", "attach_file_prepare_text": "Preparing to attach file...",
"@attach_file_prepare_text": { "@attach_file_prepare_text": {
"type": "text", "type": "text",
@@ -842,6 +854,12 @@
"placeholders_order": [], "placeholders_order": [],
"placeholders": {} "placeholders": {}
}, },
"attachment": "Attachment",
"@attachment": {
"type": "text",
"placeholders_order": [],
"placeholders": {}
},
"showAll": "Show all", "showAll": "Show all",
"@showAll": { "@showAll": {
"type": "text", "type": "text",
@@ -4842,7 +4860,7 @@
"placeholders_order": [], "placeholders_order": [],
"placeholders": {} "placeholders": {}
}, },
"attachmentReminderModalMessage": "You wrote {keyword} in your message but did not add any attachments. Do you still want to send ?", "attachmentReminderModalMessage": "You wrote {keyword} in your message but did not add any attachments. Do you still want to send?",
"@attachmentReminderModalMessage": { "@attachmentReminderModalMessage": {
"type": "text", "type": "text",
"placeholders_order": [ "placeholders_order": [
@@ -392,6 +392,14 @@ class AppLocalizations {
); );
} }
String singularAttachmentTitleHeader(int count, String totalSize) {
return Intl.message(
'$count Attachment ($totalSize)',
name: 'singularAttachmentTitleHeader',
args: [count, totalSize]
);
}
String get attach_file_prepare_text { String get attach_file_prepare_text {
return Intl.message( return Intl.message(
'Preparing to attach file...', 'Preparing to attach file...',
@@ -853,6 +861,13 @@ class AppLocalizations {
name: 'attachments'); name: 'attachments');
} }
String get attachment {
return Intl.message(
'Attachment',
name: 'attachment',
);
}
String get showAll { String get showAll {
return Intl.message( return Intl.message(
'Show all', 'Show all',