Skip to content

Commit 31446d5

Browse files
committed
compose: Translate message for a filename with size
The string is used at the end of the "errorFilesTooLarge" message, which includes a list of files with its size that are too large. We didn't mention that it is a part of the error message because this part of the context is not as relevant as that it fits in a single line. Signed-off-by: Zixuan James Li <zixuan@zulip.com>
1 parent 4760127 commit 31446d5

10 files changed

+51
-1
lines changed

assets/l10n/app_en.arb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,14 @@
171171
"filename": {"type": "String", "example": "file.txt"}
172172
}
173173
},
174+
"filenameAndSizeInMiB": "{filename}: {size} MiB",
175+
"@filenameAndSizeInMiB": {
176+
"description": "The name of a file, and its size in mebibytes.",
177+
"placeholders": {
178+
"filename": {"type": "String", "example": "foo.txt"},
179+
"size": {"type": "String", "example": "20.2"}
180+
}
181+
},
174182
"errorFilesTooLarge": "{num, plural, =1{File is} other{{num} files are}} larger than the server's limit of {maxFileUploadSizeMib} MiB and will not be uploaded:\n\n{listMessage}",
175183
"@errorFilesTooLarge": {
176184
"description": "Error message when attached files are too large in size.",

lib/generated/l10n/zulip_localizations.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,12 @@ abstract class ZulipLocalizations {
351351
/// **'Failed to upload file: {filename}'**
352352
String errorFailedToUploadFileTitle(String filename);
353353

354+
/// The name of a file, and its size in mebibytes.
355+
///
356+
/// In en, this message translates to:
357+
/// **'{filename}: {size} MiB'**
358+
String filenameAndSizeInMiB(String filename, String size);
359+
354360
/// Error message when attached files are too large in size.
355361
///
356362
/// In en, this message translates to:

lib/generated/l10n/zulip_localizations_ar.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
137137
return 'Failed to upload file: $filename';
138138
}
139139

140+
@override
141+
String filenameAndSizeInMiB(String filename, String size) {
142+
return '$filename: $size MiB';
143+
}
144+
140145
@override
141146
String errorFilesTooLarge(int num, int maxFileUploadSizeMib, String listMessage) {
142147
String _temp0 = intl.Intl.pluralLogic(

lib/generated/l10n/zulip_localizations_en.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
137137
return 'Failed to upload file: $filename';
138138
}
139139

140+
@override
141+
String filenameAndSizeInMiB(String filename, String size) {
142+
return '$filename: $size MiB';
143+
}
144+
140145
@override
141146
String errorFilesTooLarge(int num, int maxFileUploadSizeMib, String listMessage) {
142147
String _temp0 = intl.Intl.pluralLogic(

lib/generated/l10n/zulip_localizations_ja.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
137137
return 'Failed to upload file: $filename';
138138
}
139139

140+
@override
141+
String filenameAndSizeInMiB(String filename, String size) {
142+
return '$filename: $size MiB';
143+
}
144+
140145
@override
141146
String errorFilesTooLarge(int num, int maxFileUploadSizeMib, String listMessage) {
142147
String _temp0 = intl.Intl.pluralLogic(

lib/generated/l10n/zulip_localizations_nb.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
137137
return 'Failed to upload file: $filename';
138138
}
139139

140+
@override
141+
String filenameAndSizeInMiB(String filename, String size) {
142+
return '$filename: $size MiB';
143+
}
144+
140145
@override
141146
String errorFilesTooLarge(int num, int maxFileUploadSizeMib, String listMessage) {
142147
String _temp0 = intl.Intl.pluralLogic(

lib/generated/l10n/zulip_localizations_pl.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
137137
return 'Nie udało się załadować pliku: $filename';
138138
}
139139

140+
@override
141+
String filenameAndSizeInMiB(String filename, String size) {
142+
return '$filename: $size MiB';
143+
}
144+
140145
@override
141146
String errorFilesTooLarge(int num, int maxFileUploadSizeMib, String listMessage) {
142147
String _temp0 = intl.Intl.pluralLogic(

lib/generated/l10n/zulip_localizations_ru.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
137137
return 'Не удалось загрузить файл: $filename';
138138
}
139139

140+
@override
141+
String filenameAndSizeInMiB(String filename, String size) {
142+
return '$filename: $size MiB';
143+
}
144+
140145
@override
141146
String errorFilesTooLarge(int num, int maxFileUploadSizeMib, String listMessage) {
142147
String _temp0 = intl.Intl.pluralLogic(

lib/generated/l10n/zulip_localizations_sk.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
137137
return 'Nepodarilo sa nahrať súbor: $filename';
138138
}
139139

140+
@override
141+
String filenameAndSizeInMiB(String filename, String size) {
142+
return '$filename: $size MiB';
143+
}
144+
140145
@override
141146
String errorFilesTooLarge(int num, int maxFileUploadSizeMib, String listMessage) {
142147
String _temp0 = intl.Intl.pluralLogic(

lib/widgets/compose_box.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,8 @@ Future<void> _uploadFiles({
709709

710710
if (tooLargeFiles.isNotEmpty) {
711711
final listMessage = tooLargeFiles
712-
.map((file) => '${file.filename}: ${(file.length / (1 << 20)).toStringAsFixed(1)} MiB')
712+
.map((file) => zulipLocalizations.filenameAndSizeInMiB(
713+
file.filename, (file.length / (1 << 20)).toStringAsFixed(1)))
713714
.join('\n');
714715
showErrorDialog(
715716
context: context,

0 commit comments

Comments
 (0)