Skip to content

Commit c774dba

Browse files
committed
msglist: Mostly translate remaining strings on message list page
Ideally we should implement zulip#1080 for DMs title, but we might switch to showing avatars as the TODO indicated before we work on lists' proper translation. Signed-off-by: Zixuan James Li <[email protected]>
1 parent 3712f7e commit c774dba

9 files changed

+110
-7
lines changed

assets/l10n/app_en.arb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,13 @@
355355
"others": {"type": "String", "example": "Alice, Bob"}
356356
}
357357
},
358+
"messageListDMsWithOthers": "DMs with {others}",
359+
"@messageListDMsWithOthers": {
360+
"description": "Message list page title for a DM group with others.",
361+
"placeholders": {
362+
"others": {"type": "String", "example": "Alice, Bob"}
363+
}
364+
},
358365
"messageListGroupYouWithYourself": "You with yourself",
359366
"@messageListGroupYouWithYourself": {
360367
"description": "Message list recipient header for a DM group that only includes yourself."
@@ -716,5 +723,13 @@
716723
"videoDurationLabel": "Video duration",
717724
"@videoDurationLabel": {
718725
"description": "The total duration of the video."
726+
},
727+
"noEarlierMessages": "No earlier messages",
728+
"@noEarlierMessages": {
729+
"description": "Text to show at the start of a message list if there is no earlier messages."
730+
},
731+
"scrollToBottomTooltip": "Scroll to bottom",
732+
"@scrollToBottomTooltip": {
733+
"description": "Tooltip for button to scroll to bottom."
719734
}
720735
}

lib/generated/l10n/zulip_localizations.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,12 @@ abstract class ZulipLocalizations {
573573
/// **'You and {others}'**
574574
String messageListGroupYouAndOthers(String others);
575575

576+
/// Message list page title for a DM group with others.
577+
///
578+
/// In en, this message translates to:
579+
/// **'DMs with {others}'**
580+
String messageListDMsWithOthers(String others);
581+
576582
/// Message list recipient header for a DM group that only includes yourself.
577583
///
578584
/// In en, this message translates to:
@@ -1064,6 +1070,18 @@ abstract class ZulipLocalizations {
10641070
/// In en, this message translates to:
10651071
/// **'Video duration'**
10661072
String get videoDurationLabel;
1073+
1074+
/// Text to show at the start of a message list if there is no earlier messages.
1075+
///
1076+
/// In en, this message translates to:
1077+
/// **'No earlier messages'**
1078+
String get noEarlierMessages;
1079+
1080+
/// Tooltip for button to scroll to bottom.
1081+
///
1082+
/// In en, this message translates to:
1083+
/// **'Scroll to bottom'**
1084+
String get scrollToBottomTooltip;
10671085
}
10681086

10691087
class _ZulipLocalizationsDelegate extends LocalizationsDelegate<ZulipLocalizations> {

lib/generated/l10n/zulip_localizations_ar.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
280280
return 'You and $others';
281281
}
282282

283+
@override
284+
String messageListDMsWithOthers(String others) {
285+
return 'DMs with $others';
286+
}
287+
283288
@override
284289
String get messageListGroupYouWithYourself => 'You with yourself';
285290

@@ -563,4 +568,10 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
563568

564569
@override
565570
String get videoDurationLabel => 'Video duration';
571+
572+
@override
573+
String get noEarlierMessages => 'No earlier messages';
574+
575+
@override
576+
String get scrollToBottomTooltip => 'Scroll to bottom';
566577
}

lib/generated/l10n/zulip_localizations_en.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
280280
return 'You and $others';
281281
}
282282

283+
@override
284+
String messageListDMsWithOthers(String others) {
285+
return 'DMs with $others';
286+
}
287+
283288
@override
284289
String get messageListGroupYouWithYourself => 'You with yourself';
285290

@@ -563,4 +568,10 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
563568

564569
@override
565570
String get videoDurationLabel => 'Video duration';
571+
572+
@override
573+
String get noEarlierMessages => 'No earlier messages';
574+
575+
@override
576+
String get scrollToBottomTooltip => 'Scroll to bottom';
566577
}

lib/generated/l10n/zulip_localizations_ja.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
280280
return 'You and $others';
281281
}
282282

283+
@override
284+
String messageListDMsWithOthers(String others) {
285+
return 'DMs with $others';
286+
}
287+
283288
@override
284289
String get messageListGroupYouWithYourself => 'You with yourself';
285290

@@ -563,4 +568,10 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
563568

564569
@override
565570
String get videoDurationLabel => 'Video duration';
571+
572+
@override
573+
String get noEarlierMessages => 'No earlier messages';
574+
575+
@override
576+
String get scrollToBottomTooltip => 'Scroll to bottom';
566577
}

lib/generated/l10n/zulip_localizations_nb.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
280280
return 'You and $others';
281281
}
282282

283+
@override
284+
String messageListDMsWithOthers(String others) {
285+
return 'DMs with $others';
286+
}
287+
283288
@override
284289
String get messageListGroupYouWithYourself => 'You with yourself';
285290

@@ -563,4 +568,10 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
563568

564569
@override
565570
String get videoDurationLabel => 'Video duration';
571+
572+
@override
573+
String get noEarlierMessages => 'No earlier messages';
574+
575+
@override
576+
String get scrollToBottomTooltip => 'Scroll to bottom';
566577
}

lib/generated/l10n/zulip_localizations_pl.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
280280
return 'Ty i $others';
281281
}
282282

283+
@override
284+
String messageListDMsWithOthers(String others) {
285+
return 'DMs with $others';
286+
}
287+
283288
@override
284289
String get messageListGroupYouWithYourself => 'Ty ze sobą';
285290

@@ -563,4 +568,10 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
563568

564569
@override
565570
String get videoDurationLabel => 'Video duration';
571+
572+
@override
573+
String get noEarlierMessages => 'No earlier messages';
574+
575+
@override
576+
String get scrollToBottomTooltip => 'Scroll to bottom';
566577
}

lib/generated/l10n/zulip_localizations_ru.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
280280
return 'You and $others';
281281
}
282282

283+
@override
284+
String messageListDMsWithOthers(String others) {
285+
return 'DMs with $others';
286+
}
287+
283288
@override
284289
String get messageListGroupYouWithYourself => 'You with yourself';
285290

@@ -563,4 +568,10 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
563568

564569
@override
565570
String get videoDurationLabel => 'Video duration';
571+
572+
@override
573+
String get noEarlierMessages => 'No earlier messages';
574+
575+
@override
576+
String get scrollToBottomTooltip => 'Scroll to bottom';
566577
}

lib/widgets/message_list.dart

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,9 @@ class MessageListAppBarTitle extends StatelessWidget {
426426
} else {
427427
final names = otherRecipientIds.map(
428428
(id) => store.users[id]?.fullName ?? zulipLocalizations.unknownUserName);
429-
return Text("DMs with ${names.join(", ")}"); // TODO show avatars
429+
// TODO show avatars
430+
return Text(
431+
zulipLocalizations.messageListDMsWithOthers(names.join(', ')));
430432
}
431433
}
432434
}
@@ -567,6 +569,7 @@ class _MessageListState extends State<MessageList> with PerAccountStoreAwareStat
567569
Widget _buildListView(BuildContext context) {
568570
final length = model!.items.length;
569571
const centerSliverKey = ValueKey('center sliver');
572+
final zulipLocalizations = ZulipLocalizations.of(context);
570573

571574
Widget sliver = SliverStickyHeaderList(
572575
headerPlacement: HeaderPlacement.scrollingStart,
@@ -603,7 +606,7 @@ class _MessageListState extends State<MessageList> with PerAccountStoreAwareStat
603606
if (i == 2) return TypingStatusWidget(narrow: widget.narrow);
604607

605608
final data = model!.items[length - 1 - (i - 3)];
606-
return _buildItem(data, i);
609+
return _buildItem(zulipLocalizations, data, i);
607610
}));
608611

609612
if (!ComposeBox.hasComposeBox(widget.narrow)) {
@@ -639,13 +642,13 @@ class _MessageListState extends State<MessageList> with PerAccountStoreAwareStat
639642
]);
640643
}
641644

642-
Widget _buildItem(MessageListItem data, int i) {
645+
Widget _buildItem(ZulipLocalizations zulipLocalizations, MessageListItem data, int i) {
643646
switch (data) {
644647
case MessageListHistoryStartItem():
645-
return const Center(
648+
return Center(
646649
child: Padding(
647-
padding: EdgeInsets.symmetric(vertical: 16.0),
648-
child: Text("No earlier messages."))); // TODO use an icon
650+
padding: const EdgeInsets.symmetric(vertical: 16.0),
651+
child: Text(zulipLocalizations.noEarlierMessages))); // TODO use an icon
649652
case MessageListLoadingItem():
650653
return const Center(
651654
child: Padding(
@@ -689,14 +692,15 @@ class ScrollToBottomButton extends StatelessWidget {
689692

690693
@override
691694
Widget build(BuildContext context) {
695+
final zulipLocalizations = ZulipLocalizations.of(context);
692696
return ValueListenableBuilder<bool>(
693697
valueListenable: visibleValue,
694698
builder: (BuildContext context, bool value, Widget? child) {
695699
return (value && child != null) ? child : const SizedBox.shrink();
696700
},
697701
// TODO: fix hardcoded values for size and style here
698702
child: IconButton(
699-
tooltip: "Scroll to bottom",
703+
tooltip: zulipLocalizations.scrollToBottomTooltip,
700704
icon: const Icon(Icons.expand_circle_down_rounded),
701705
iconSize: 40,
702706
// Web has the same color in light and dark mode.

0 commit comments

Comments
 (0)