Skip to content

Commit 9e63c58

Browse files
committed
compose: Add translations for ContentValidationError enum
1 parent 519eff2 commit 9e63c58

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

assets/l10n/app_en.arb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,22 @@
7575
"@successMessageCopied": {
7676
"description": "Message when content of a message was copied to the users system clipboard."
7777
},
78+
"contentValidationErrorTooLong": "Message length shouldn't be greater than 10000 characters.",
79+
"@contentValidationErrorTooLong": {
80+
"description": "Content validation error message when the message is too long."
81+
},
82+
"contentValidationErrorEmpty": "You have nothing to send!",
83+
"@contentValidationErrorEmpty": {
84+
"description": "Content validation error message when the message is empty."
85+
},
86+
"contentValidationErrorQuoteAndReplyInProgress": "Please wait for the quotation to complete.",
87+
"@contentValidationErrorQuoteAndReplyInProgress": {
88+
"description": "Content validation error message when a quotation has not completed yet."
89+
},
90+
"contentValidationErrorUploadInProgress": "Please wait for the upload to complete.",
91+
"@contentValidationErrorUploadInProgress": {
92+
"description": "Content validation error message when attachments have not finished uploading."
93+
},
7894
"dialogCancel": "Cancel",
7995
"@dialogCancel": {
8096
"description": "Button label in dialogs to cancel."

lib/widgets/compose_box.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,16 @@ enum ContentValidationError {
9090
quoteAndReplyInProgress,
9191
uploadInProgress;
9292

93-
String message() {
93+
String message(ZulipLocalizations zulipLocalizations) {
9494
switch (this) {
9595
case ContentValidationError.tooLong:
96-
return "Message length shouldn't be greater than 10000 characters.";
96+
return zulipLocalizations.contentValidationErrorTooLong;
9797
case ContentValidationError.empty:
98-
return 'You have nothing to send!';
98+
return zulipLocalizations.contentValidationErrorEmpty;
9999
case ContentValidationError.quoteAndReplyInProgress:
100-
return 'Please wait for the quotation to complete.';
100+
return zulipLocalizations.contentValidationErrorQuoteAndReplyInProgress;
101101
case ContentValidationError.uploadInProgress:
102-
return 'Please wait for the upload to complete.';
102+
return zulipLocalizations.contentValidationErrorUploadInProgress;
103103
}
104104
}
105105
}
@@ -704,7 +704,7 @@ class _SendButtonState extends State<_SendButton> {
704704
for (final error in widget.topicController?.validationErrors ?? const [])
705705
error.message(zulipLocalizations),
706706
for (final error in widget.contentController.validationErrors)
707-
error.message(),
707+
error.message(zulipLocalizations),
708708
];
709709
showErrorDialog(
710710
context: context,

0 commit comments

Comments
 (0)