Skip to content

Commit a78f66c

Browse files
committed
compose: Translate "(loading message {messageId})"
and implement the necessary plumbing to access ZulipLocalizations Signed-off-by: Zixuan James Li <[email protected]>
1 parent 3eb36ac commit a78f66c

14 files changed

+68
-7
lines changed

assets/l10n/app_en.arb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,13 @@
351351
"filename": {"type": "String", "example": "file.txt"}
352352
}
353353
},
354+
"composeBoxLoadingMessage": "(loading message {messageId})",
355+
"@composeBoxLoadingMessage": {
356+
"description": "Placeholder in compose box showing the quoted message is currently loading.",
357+
"placeholders": {
358+
"messageId": {"type": "int", "example": "1234"}
359+
}
360+
},
354361
"unknownUserName": "(unknown user)",
355362
"@unknownUserName": {
356363
"description": "Name placeholder to use for a user when we don't know their name."

lib/generated/l10n/zulip_localizations.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,12 @@ abstract class ZulipLocalizations {
567567
/// **'Uploading {filename}…'**
568568
String composeBoxUploadingFilename(String filename);
569569

570+
/// Placeholder in compose box showing the quoted message is currently loading.
571+
///
572+
/// In en, this message translates to:
573+
/// **'(loading message {messageId})'**
574+
String composeBoxLoadingMessage(int messageId);
575+
570576
/// Name placeholder to use for a user when we don't know their name.
571577
///
572578
/// 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
@@ -277,6 +277,11 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
277277
return 'Uploading $filename…';
278278
}
279279

280+
@override
281+
String composeBoxLoadingMessage(int messageId) {
282+
return '(loading message $messageId)';
283+
}
284+
280285
@override
281286
String get unknownUserName => '(unknown user)';
282287

lib/generated/l10n/zulip_localizations_en.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,11 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
277277
return 'Uploading $filename…';
278278
}
279279

280+
@override
281+
String composeBoxLoadingMessage(int messageId) {
282+
return '(loading message $messageId)';
283+
}
284+
280285
@override
281286
String get unknownUserName => '(unknown user)';
282287

lib/generated/l10n/zulip_localizations_ja.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,11 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
277277
return 'Uploading $filename…';
278278
}
279279

280+
@override
281+
String composeBoxLoadingMessage(int messageId) {
282+
return '(loading message $messageId)';
283+
}
284+
280285
@override
281286
String get unknownUserName => '(unknown user)';
282287

lib/generated/l10n/zulip_localizations_nb.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,11 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
277277
return 'Uploading $filename…';
278278
}
279279

280+
@override
281+
String composeBoxLoadingMessage(int messageId) {
282+
return '(loading message $messageId)';
283+
}
284+
280285
@override
281286
String get unknownUserName => '(unknown user)';
282287

lib/generated/l10n/zulip_localizations_pl.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,11 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
277277
return 'Przekazywanie $filename…';
278278
}
279279

280+
@override
281+
String composeBoxLoadingMessage(int messageId) {
282+
return '(loading message $messageId)';
283+
}
284+
280285
@override
281286
String get unknownUserName => '(nieznany użytkownik)';
282287

lib/generated/l10n/zulip_localizations_ru.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,11 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
277277
return 'Загрузка $filename…';
278278
}
279279

280+
@override
281+
String composeBoxLoadingMessage(int messageId) {
282+
return '(loading message $messageId)';
283+
}
284+
280285
@override
281286
String get unknownUserName => '(неизвестный пользователь)';
282287

lib/generated/l10n/zulip_localizations_sk.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,11 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
277277
return 'Uploading $filename…';
278278
}
279279

280+
@override
281+
String composeBoxLoadingMessage(int messageId) {
282+
return '(loading message $messageId)';
283+
}
284+
280285
@override
281286
String get unknownUserName => '(unknown user)';
282287

lib/model/compose.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'dart:math';
22

33
import '../api/model/model.dart';
4+
import '../generated/l10n/zulip_localizations.dart';
45
import 'internal_link.dart';
56
import 'narrow.dart';
67
import 'store.dart';
@@ -136,7 +137,9 @@ String inlineLink(String visibleText, Uri? destination) {
136137
}
137138

138139
/// What we show while fetching the target message's raw Markdown.
139-
String quoteAndReplyPlaceholder(PerAccountStore store, {
140+
String quoteAndReplyPlaceholder(
141+
ZulipLocalizations zulipLocalizations,
142+
PerAccountStore store, {
140143
required Message message,
141144
}) {
142145
final sender = store.users[message.senderId];
@@ -146,7 +149,7 @@ String quoteAndReplyPlaceholder(PerAccountStore store, {
146149
nearMessageId: message.id);
147150
// See note in [quoteAndReply] about asking `mention` to omit the |<id> part.
148151
return '${mention(sender!, silent: true)} ${inlineLink('said', url)}: ' // TODO(#1285)
149-
'*(loading message ${message.id})*\n'; // TODO(i18n) ?
152+
'*${zulipLocalizations.composeBoxLoadingMessage(message.id)}*\n';
150153
}
151154

152155
/// Quote-and-reply syntax.

0 commit comments

Comments
 (0)