Skip to content

Commit e4f48e2

Browse files
committed
inbox: Make header titles localizable
Signed-off-by: Zixuan James Li <[email protected]>
1 parent 00bd5b9 commit e4f48e2

11 files changed

+138
-10
lines changed

assets/l10n/app_en.arb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,10 @@
586586
"@recentDmConversationsPageTitle": {
587587
"description": "Title for the page with a list of DM conversations."
588588
},
589+
"recentDmConversationsSectionHeader": "Direct messages",
590+
"@recentDmConversationsSectionHeader": {
591+
"description": "Heading for direct messages section on the 'Inbox' message view."
592+
},
589593
"combinedFeedPageTitle": "Combined feed",
590594
"@combinedFeedPageTitle": {
591595
"description": "Page title for the 'Combined feed' message view."
@@ -618,6 +622,18 @@
618622
"numOthers": {"type": "int", "example": "4"}
619623
}
620624
},
625+
"pinnedSubscriptionsLabel": "Pinned",
626+
"@pinnedSubscriptionsLabel": {
627+
"description": "Label for the list of pinned subscribed channels."
628+
},
629+
"unpinnedSubscriptionsLabel": "Unpinned",
630+
"@unpinnedSubscriptionsLabel": {
631+
"description": "Label for the list of unpinned subscribed channels."
632+
},
633+
"subscriptionListNoChannels": "No channels found",
634+
"@subscriptionListNoChannels": {
635+
"description": "Text to display on subscribed-channels page when there are no subscribed channels."
636+
},
621637
"notifSelfUser": "You",
622638
"@notifSelfUser": {
623639
"description": "Display name for the user themself, to show after replying in an Android notification"

lib/generated/l10n/zulip_localizations.dart

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,12 @@ abstract class ZulipLocalizations {
891891
/// **'Direct messages'**
892892
String get recentDmConversationsPageTitle;
893893

894+
/// Heading for direct messages section on the 'Inbox' message view.
895+
///
896+
/// In en, this message translates to:
897+
/// **'Direct messages'**
898+
String get recentDmConversationsSectionHeader;
899+
894900
/// Page title for the 'Combined feed' message view.
895901
///
896902
/// In en, this message translates to:
@@ -933,6 +939,24 @@ abstract class ZulipLocalizations {
933939
/// **'{senderFullName} to you and {numOthers, plural, =1{1 other} other{{numOthers} others}}'**
934940
String notifGroupDmConversationLabel(String senderFullName, int numOthers);
935941

942+
/// Label for the list of pinned subscribed channels.
943+
///
944+
/// In en, this message translates to:
945+
/// **'Pinned'**
946+
String get pinnedSubscriptionsLabel;
947+
948+
/// Label for the list of unpinned subscribed channels.
949+
///
950+
/// In en, this message translates to:
951+
/// **'Unpinned'**
952+
String get unpinnedSubscriptionsLabel;
953+
954+
/// Text to display on subscribed-channels page when there are no subscribed channels.
955+
///
956+
/// In en, this message translates to:
957+
/// **'No channels found'**
958+
String get subscriptionListNoChannels;
959+
936960
/// Display name for the user themself, to show after replying in an Android notification
937961
///
938962
/// In en, this message translates to:

lib/generated/l10n/zulip_localizations_ar.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,9 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
463463
@override
464464
String get recentDmConversationsPageTitle => 'Direct messages';
465465

466+
@override
467+
String get recentDmConversationsSectionHeader => 'Direct messages';
468+
466469
@override
467470
String get combinedFeedPageTitle => 'Combined feed';
468471

@@ -492,6 +495,15 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
492495
return '$senderFullName to you and $_temp0';
493496
}
494497

498+
@override
499+
String get pinnedSubscriptionsLabel => 'Pinned';
500+
501+
@override
502+
String get unpinnedSubscriptionsLabel => 'Unpinned';
503+
504+
@override
505+
String get subscriptionListNoChannels => 'No channels found';
506+
495507
@override
496508
String get notifSelfUser => 'You';
497509

lib/generated/l10n/zulip_localizations_en.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,9 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
463463
@override
464464
String get recentDmConversationsPageTitle => 'Direct messages';
465465

466+
@override
467+
String get recentDmConversationsSectionHeader => 'Direct messages';
468+
466469
@override
467470
String get combinedFeedPageTitle => 'Combined feed';
468471

@@ -492,6 +495,15 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
492495
return '$senderFullName to you and $_temp0';
493496
}
494497

498+
@override
499+
String get pinnedSubscriptionsLabel => 'Pinned';
500+
501+
@override
502+
String get unpinnedSubscriptionsLabel => 'Unpinned';
503+
504+
@override
505+
String get subscriptionListNoChannels => 'No channels found';
506+
495507
@override
496508
String get notifSelfUser => 'You';
497509

lib/generated/l10n/zulip_localizations_ja.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,9 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
463463
@override
464464
String get recentDmConversationsPageTitle => 'Direct messages';
465465

466+
@override
467+
String get recentDmConversationsSectionHeader => 'Direct messages';
468+
466469
@override
467470
String get combinedFeedPageTitle => 'Combined feed';
468471

@@ -492,6 +495,15 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
492495
return '$senderFullName to you and $_temp0';
493496
}
494497

498+
@override
499+
String get pinnedSubscriptionsLabel => 'Pinned';
500+
501+
@override
502+
String get unpinnedSubscriptionsLabel => 'Unpinned';
503+
504+
@override
505+
String get subscriptionListNoChannels => 'No channels found';
506+
495507
@override
496508
String get notifSelfUser => 'You';
497509

lib/generated/l10n/zulip_localizations_nb.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,9 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
463463
@override
464464
String get recentDmConversationsPageTitle => 'Direct messages';
465465

466+
@override
467+
String get recentDmConversationsSectionHeader => 'Direct messages';
468+
466469
@override
467470
String get combinedFeedPageTitle => 'Combined feed';
468471

@@ -492,6 +495,15 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
492495
return '$senderFullName to you and $_temp0';
493496
}
494497

498+
@override
499+
String get pinnedSubscriptionsLabel => 'Pinned';
500+
501+
@override
502+
String get unpinnedSubscriptionsLabel => 'Unpinned';
503+
504+
@override
505+
String get subscriptionListNoChannels => 'No channels found';
506+
495507
@override
496508
String get notifSelfUser => 'You';
497509

lib/generated/l10n/zulip_localizations_pl.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,9 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
463463
@override
464464
String get recentDmConversationsPageTitle => 'Wiadomości bezpośrednie';
465465

466+
@override
467+
String get recentDmConversationsSectionHeader => 'Direct messages';
468+
466469
@override
467470
String get combinedFeedPageTitle => 'Mieszany widok';
468471

@@ -492,6 +495,15 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
492495
return '$senderFullName do ciebie i $_temp0';
493496
}
494497

498+
@override
499+
String get pinnedSubscriptionsLabel => 'Pinned';
500+
501+
@override
502+
String get unpinnedSubscriptionsLabel => 'Unpinned';
503+
504+
@override
505+
String get subscriptionListNoChannels => 'No channels found';
506+
495507
@override
496508
String get notifSelfUser => 'Ty';
497509

lib/generated/l10n/zulip_localizations_ru.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,9 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
463463
@override
464464
String get recentDmConversationsPageTitle => 'Личные сообщения';
465465

466+
@override
467+
String get recentDmConversationsSectionHeader => 'Direct messages';
468+
466469
@override
467470
String get combinedFeedPageTitle => 'Объединенная лента';
468471

@@ -492,6 +495,15 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
492495
return '$senderFullName вам и еще $_temp0';
493496
}
494497

498+
@override
499+
String get pinnedSubscriptionsLabel => 'Pinned';
500+
501+
@override
502+
String get unpinnedSubscriptionsLabel => 'Unpinned';
503+
504+
@override
505+
String get subscriptionListNoChannels => 'No channels found';
506+
495507
@override
496508
String get notifSelfUser => 'Вы';
497509

lib/generated/l10n/zulip_localizations_sk.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,9 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
463463
@override
464464
String get recentDmConversationsPageTitle => 'Priama správa';
465465

466+
@override
467+
String get recentDmConversationsSectionHeader => 'Direct messages';
468+
466469
@override
467470
String get combinedFeedPageTitle => 'Zlúčený kanál';
468471

@@ -492,6 +495,15 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
492495
return '$senderFullName to you and $_temp0';
493496
}
494497

498+
@override
499+
String get pinnedSubscriptionsLabel => 'Pinned';
500+
501+
@override
502+
String get unpinnedSubscriptionsLabel => 'Unpinned';
503+
504+
@override
505+
String get subscriptionListNoChannels => 'No channels found';
506+
495507
@override
496508
String get notifSelfUser => 'Ty';
497509

lib/widgets/inbox.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22

33
import '../api/model/model.dart';
4+
import '../generated/l10n/zulip_localizations.dart';
45
import '../model/narrow.dart';
56
import '../model/recent_dm_conversations.dart';
67
import '../model/unreads.dart';
@@ -237,7 +238,7 @@ abstract class _HeaderItem extends StatelessWidget {
237238
required this.sectionContext,
238239
});
239240

240-
String get title;
241+
String title(ZulipLocalizations zulipLocalizations);
241242
IconData get icon;
242243
Color collapsedIconColor(BuildContext context);
243244
Color uncollapsedIconColor(BuildContext context);
@@ -257,6 +258,7 @@ abstract class _HeaderItem extends StatelessWidget {
257258

258259
@override
259260
Widget build(BuildContext context) {
261+
final zulipLocalizations = ZulipLocalizations.of(context);
260262
final designVariables = DesignVariables.of(context);
261263
return Material(
262264
color: collapsed
@@ -291,7 +293,7 @@ abstract class _HeaderItem extends StatelessWidget {
291293
).merge(weightVariableTextStyle(context, wght: 600)),
292294
maxLines: 1,
293295
overflow: TextOverflow.ellipsis,
294-
title))),
296+
title(zulipLocalizations)))),
295297
const SizedBox(width: 12),
296298
if (hasMention) const _IconMarker(icon: ZulipIcons.at_sign),
297299
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
@@ -312,7 +314,8 @@ class _AllDmsHeaderItem extends _HeaderItem {
312314
required super.sectionContext,
313315
});
314316

315-
@override String get title => 'Direct messages'; // TODO(i18n)
317+
@override String title(ZulipLocalizations zulipLocalizations) =>
318+
zulipLocalizations.recentDmConversationsSectionHeader;
316319
@override IconData get icon => ZulipIcons.user;
317320

318321
// TODO(design) check if this is the right variable for these
@@ -436,7 +439,8 @@ class _StreamHeaderItem extends _HeaderItem {
436439
required super.sectionContext,
437440
});
438441

439-
@override String get title => subscription.name;
442+
@override String title(ZulipLocalizations zulipLocalizations) =>
443+
subscription.name;
440444
@override IconData get icon => iconDataForStream(subscription);
441445
@override Color collapsedIconColor(context) =>
442446
colorSwatchFor(context, subscription).iconOnPlainBackground;

lib/widgets/subscription_list.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22

33
import '../api/model/model.dart';
4+
import '../generated/l10n/zulip_localizations.dart';
45
import '../model/narrow.dart';
56
import '../model/unreads.dart';
67
import 'icons.dart';
@@ -77,10 +78,8 @@ class _SubscriptionListPageBodyState extends State<SubscriptionListPageBody> wit
7778

7879
// TODO: Implement collapsible topics
7980

80-
// TODO(i18n): localize strings on page
81-
// Strings here left unlocalized as they likely will not
82-
// exist in the settled design.
8381
final store = PerAccountStoreWidget.of(context);
82+
final zulipLocalizations = ZulipLocalizations.of(context);
8483

8584
final List<Subscription> pinned = [];
8685
final List<Subscription> unpinned = [];
@@ -102,11 +101,11 @@ class _SubscriptionListPageBodyState extends State<SubscriptionListPageBody> wit
102101
if (pinned.isEmpty && unpinned.isEmpty)
103102
const _NoSubscriptionsItem(),
104103
if (pinned.isNotEmpty) ...[
105-
const _SubscriptionListHeader(label: "Pinned"),
104+
_SubscriptionListHeader(label: zulipLocalizations.pinnedSubscriptionsLabel),
106105
_SubscriptionList(unreadsModel: unreadsModel, subscriptions: pinned),
107106
],
108107
if (unpinned.isNotEmpty) ...[
109-
const _SubscriptionListHeader(label: "Unpinned"),
108+
_SubscriptionListHeader(label: zulipLocalizations.unpinnedSubscriptionsLabel),
110109
_SubscriptionList(unreadsModel: unreadsModel, subscriptions: unpinned),
111110
],
112111

@@ -124,11 +123,12 @@ class _NoSubscriptionsItem extends StatelessWidget {
124123
@override
125124
Widget build(BuildContext context) {
126125
final designVariables = DesignVariables.of(context);
126+
final zulipLocalizations = ZulipLocalizations.of(context);
127127

128128
return SliverToBoxAdapter(
129129
child: Padding(
130130
padding: const EdgeInsets.all(10),
131-
child: Text("No channels found",
131+
child: Text(zulipLocalizations.subscriptionListNoChannels,
132132
textAlign: TextAlign.center,
133133
style: TextStyle(
134134
color: designVariables.subscriptionListHeaderText,

0 commit comments

Comments
 (0)