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,
bccPrefix: appLocalizations.bcc_email_address_prefix,
replyToPrefix: appLocalizations.replyToEmailAddressPrefix,
titleAttachment: appLocalizations.attachments.toLowerCase(),
titleAttachment: uploadController.allAttachmentsUploaded.length > 1
? appLocalizations.attachments.toLowerCase()
: appLocalizations.attachment.toLowerCase(),
toAddress: listToEmailAddress.toSet().listEmailAddressToString(
isFullEmailAddress: true,
),
@@ -57,7 +57,9 @@ class AttachmentHeaderComposerWidget extends StatelessWidget {
),
const SizedBox(width: AttachmentHeaderComposerWidgetStyle.space / 2),
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
),
const SizedBox(width: AttachmentHeaderComposerWidgetStyle.space),
@@ -503,7 +503,9 @@ class EmailDataSourceImpl extends EmailDataSource {
ccPrefix: appLocalizations.cc_email_address_prefix,
bccPrefix: appLocalizations.bcc_email_address_prefix,
replyToPrefix: appLocalizations.replyToEmailAddressPrefix,
titleAttachment: appLocalizations.attachments.toLowerCase(),
titleAttachment: listPreviewAttachment.length > 1
? appLocalizations.attachments.toLowerCase()
: appLocalizations.attachment.toLowerCase(),
attachmentIcon: attachmentIconBase64Data,
toAddress: email.to?.listEmailAddressToString(isFullEmailAddress: true),
ccAddress: email.cc?.listEmailAddressToString(isFullEmailAddress: true),
@@ -343,7 +343,9 @@ class EmailLocalStorageDataSourceImpl extends EmailDataSource {
ccPrefix: appLocalizations.cc_email_address_prefix,
bccPrefix: appLocalizations.bcc_email_address_prefix,
replyToPrefix: appLocalizations.replyToEmailAddressPrefix,
titleAttachment: appLocalizations.attachments.toLowerCase(),
titleAttachment: listPreviewAttachment.length > 1
? appLocalizations.attachments.toLowerCase()
: appLocalizations.attachment.toLowerCase(),
attachmentIcon: attachmentIconBase64Data,
toAddress: email.to?.listEmailAddressToString(isFullEmailAddress: true),
ccAddress: email.cc?.listEmailAddressToString(isFullEmailAddress: true),
@@ -408,7 +408,9 @@ class EmailActionReactor {
ccPrefix: appLocalizations.cc_email_address_prefix,
bccPrefix: appLocalizations.bcc_email_address_prefix,
replyToPrefix: appLocalizations.replyToEmailAddressPrefix,
titleAttachment: appLocalizations.attachments.toLowerCase(),
titleAttachment: emailLoaded.attachments.length > 1
? appLocalizations.attachments.toLowerCase()
: appLocalizations.attachment.toLowerCase(),
toAddress: presentationEmail.to?.listEmailAddressToString(isFullEmailAddress: true),
ccAddress: presentationEmail.cc?.listEmailAddressToString(isFullEmailAddress: true),
bccAddress: presentationEmail.bcc?.listEmailAddressToString(isFullEmailAddress: true),
@@ -38,10 +38,15 @@ class AttachmentsInfo extends StatelessWidget {
);
final titleHeaderAttachment = Text(
AppLocalizations.of(context).titleHeaderAttachment(
numberOfAttachments,
totalSizeInfo,
),
numberOfAttachments > 1
? AppLocalizations.of(context).titleHeaderAttachment(
numberOfAttachments,
totalSizeInfo,
)
: AppLocalizations.of(context).singularAttachmentTitleHeader(
numberOfAttachments,
totalSizeInfo,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: ThemeUtils.textStyleInter400.copyWith(
+18
View File
@@ -363,6 +363,18 @@
"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": {
"type": "text",
@@ -787,6 +799,12 @@
"placeholders_order": [],
"placeholders": {}
},
"attachment": "Attachment",
"@attachment": {
"type": "text",
"placeholders_order": [],
"placeholders": {}
},
"showAll": "Show all",
"@showAll": {
"type": "text",
+18
View File
@@ -654,6 +654,12 @@
"placeholders_order": [],
"placeholders": {}
},
"attachment": "Pièce jointe",
"@attachment": {
"type": "text",
"placeholders_order": [],
"placeholders": {}
},
"show_all": "Tout afficher",
"@show_all": {
"type": "text",
@@ -2120,6 +2126,18 @@
"totalSize": {}
}
},
"singularAttachmentTitleHeader": "{count} Pièce jointe ({totalSize})",
"@singularAttachmentTitleHeader": {
"type": "text",
"placeholders_order": [
"count",
"totalSize"
],
"placeholders": {
"count": {},
"totalSize": {}
}
},
"undo": "Annuler",
"@undo": {
"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": {
"type": "text",
@@ -390,6 +390,18 @@
"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": {
"type": "text",
@@ -842,6 +854,12 @@
"placeholders_order": [],
"placeholders": {}
},
"attachment": "Attachment",
"@attachment": {
"type": "text",
"placeholders_order": [],
"placeholders": {}
},
"showAll": "Show all",
"@showAll": {
"type": "text",
@@ -4842,7 +4860,7 @@
"placeholders_order": [],
"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": {
"type": "text",
"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 {
return Intl.message(
'Preparing to attach file...',
@@ -853,6 +861,13 @@ class AppLocalizations {
name: 'attachments');
}
String get attachment {
return Intl.message(
'Attachment',
name: 'attachment',
);
}
String get showAll {
return Intl.message(
'Show all',