@@ -208,10 +208,11 @@ class ComposeContentController extends ComposeController<ContentValidationError>
208
208
///
209
209
/// Returns an int "tag" that should be passed to registerUploadEnd on the
210
210
/// upload's success or failure.
211
- int registerUploadStart (String filename) {
211
+ int registerUploadStart (String filename, ZulipLocalizations zulipLocalizations ) {
212
212
final tag = _nextUploadTag;
213
213
_nextUploadTag += 1 ;
214
- final placeholder = inlineLink ('Uploading $filename ...' , null ); // TODO(i18n)
214
+ final linkText = zulipLocalizations.composeBoxUploadingFilename (filename);
215
+ final placeholder = inlineLink (linkText, null );
215
216
_uploads[tag] = (filename: filename, placeholder: placeholder);
216
217
notifyListeners (); // _uploads change could affect validationErrors
217
218
value = value.replaced (insertionIndex (), '$placeholder \n\n ' );
@@ -430,6 +431,7 @@ Future<void> _uploadFiles({
430
431
}) async {
431
432
assert (context.mounted);
432
433
final store = PerAccountStoreWidget .of (context);
434
+ final zulipLocalizations = ZulipLocalizations .of (context);
433
435
434
436
final List <_File > tooLargeFiles = [];
435
437
final List <_File > rightSizeFiles = [];
@@ -445,18 +447,19 @@ Future<void> _uploadFiles({
445
447
final listMessage = tooLargeFiles
446
448
.map ((file) => '${file .filename }: ${(file .length / (1 << 20 )).toStringAsFixed (1 )} MiB' )
447
449
.join ('\n ' );
448
- showErrorDialog ( // TODO(i18n)
450
+ showErrorDialog (
449
451
context: context,
450
- title: 'File(s) too large' ,
451
- message:
452
- '${ tooLargeFiles .length } file(s) are larger than the server \' s limit'
453
- ' of ${ store .maxFileUploadSizeMib } MiB and will not be uploaded:'
454
- ' \n\n $ listMessage ' );
452
+ title: zulipLocalizations. errorFilesTooLargeTitle (tooLargeFiles.length) ,
453
+ message: zulipLocalizations. errorFilesTooLarge (
454
+ tooLargeFiles.length,
455
+ store.maxFileUploadSizeMib,
456
+ listMessage) );
455
457
}
456
458
457
459
final List <(int , _File )> uploadsInProgress = [];
458
460
for (final file in rightSizeFiles) {
459
- final tag = contentController.registerUploadStart (file.filename);
461
+ final tag = contentController.registerUploadStart (file.filename,
462
+ zulipLocalizations);
460
463
uploadsInProgress.add ((tag, file));
461
464
}
462
465
if (! contentFocusNode.hasFocus) {
@@ -475,7 +478,8 @@ Future<void> _uploadFiles({
475
478
// TODO(#37): Specifically handle `413 Payload Too Large`
476
479
// TODO(#37): On API errors, quote `msg` from server, with "The server said:"
477
480
showErrorDialog (context: context,
478
- title: 'Failed to upload file: $filename ' , message: e.toString ());
481
+ title: zulipLocalizations.errorFailedToUploadFileTitle (filename),
482
+ message: e.toString ());
479
483
} finally {
480
484
contentController.registerUploadEnd (tag, url);
481
485
}
0 commit comments