Skip to content

Commit 16211c9

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

11 files changed

+107
-10
lines changed

assets/l10n/app_en.arb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,18 @@
618618
"numOthers": {"type": "int", "example": "4"}
619619
}
620620
},
621+
"pinnedSubscriptionsLabel": "Pinned",
622+
"@pinnedSubscriptionsLabel": {
623+
"description": "Label for the list of pinned subscribed channels."
624+
},
625+
"unpinnedSubscriptionsLabel": "Unpinned",
626+
"@unpinnedSubscriptionsLabel": {
627+
"description": "Label for the list of unpinned subscribed channels."
628+
},
629+
"noSubscriptions": "No channels found",
630+
"@noSubscriptions": {
631+
"description": "Text to display when there are no subscribed channels."
632+
},
621633
"notifSelfUser": "You",
622634
"@notifSelfUser": {
623635
"description": "Display name for the user themself, to show after replying in an Android notification"

lib/generated/l10n/zulip_localizations.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,24 @@ abstract class ZulipLocalizations {
933933
/// **'{senderFullName} to you and {numOthers, plural, =1{1 other} other{{numOthers} others}}'**
934934
String notifGroupDmConversationLabel(String senderFullName, int numOthers);
935935

936+
/// Label for the list of pinned subscribed channels.
937+
///
938+
/// In en, this message translates to:
939+
/// **'Pinned'**
940+
String get pinnedSubscriptionsLabel;
941+
942+
/// Label for the list of unpinned subscribed channels.
943+
///
944+
/// In en, this message translates to:
945+
/// **'Unpinned'**
946+
String get unpinnedSubscriptionsLabel;
947+
948+
/// Text to display when there are no subscribed channels.
949+
///
950+
/// In en, this message translates to:
951+
/// **'No channels found'**
952+
String get noSubscriptions;
953+
936954
/// Display name for the user themself, to show after replying in an Android notification
937955
///
938956
/// In en, this message translates to:

lib/generated/l10n/zulip_localizations_ar.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,15 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
492492
return '$senderFullName to you and $_temp0';
493493
}
494494

495+
@override
496+
String get pinnedSubscriptionsLabel => 'Pinned';
497+
498+
@override
499+
String get unpinnedSubscriptionsLabel => 'Unpinned';
500+
501+
@override
502+
String get noSubscriptions => 'No channels found';
503+
495504
@override
496505
String get notifSelfUser => 'You';
497506

lib/generated/l10n/zulip_localizations_en.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,15 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
492492
return '$senderFullName to you and $_temp0';
493493
}
494494

495+
@override
496+
String get pinnedSubscriptionsLabel => 'Pinned';
497+
498+
@override
499+
String get unpinnedSubscriptionsLabel => 'Unpinned';
500+
501+
@override
502+
String get noSubscriptions => 'No channels found';
503+
495504
@override
496505
String get notifSelfUser => 'You';
497506

lib/generated/l10n/zulip_localizations_ja.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,15 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
492492
return '$senderFullName to you and $_temp0';
493493
}
494494

495+
@override
496+
String get pinnedSubscriptionsLabel => 'Pinned';
497+
498+
@override
499+
String get unpinnedSubscriptionsLabel => 'Unpinned';
500+
501+
@override
502+
String get noSubscriptions => 'No channels found';
503+
495504
@override
496505
String get notifSelfUser => 'You';
497506

lib/generated/l10n/zulip_localizations_nb.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,15 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
492492
return '$senderFullName to you and $_temp0';
493493
}
494494

495+
@override
496+
String get pinnedSubscriptionsLabel => 'Pinned';
497+
498+
@override
499+
String get unpinnedSubscriptionsLabel => 'Unpinned';
500+
501+
@override
502+
String get noSubscriptions => 'No channels found';
503+
495504
@override
496505
String get notifSelfUser => 'You';
497506

lib/generated/l10n/zulip_localizations_pl.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,15 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
492492
return '$senderFullName do ciebie i $_temp0';
493493
}
494494

495+
@override
496+
String get pinnedSubscriptionsLabel => 'Pinned';
497+
498+
@override
499+
String get unpinnedSubscriptionsLabel => 'Unpinned';
500+
501+
@override
502+
String get noSubscriptions => 'No channels found';
503+
495504
@override
496505
String get notifSelfUser => 'Ty';
497506

lib/generated/l10n/zulip_localizations_ru.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,15 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
492492
return '$senderFullName вам и еще $_temp0';
493493
}
494494

495+
@override
496+
String get pinnedSubscriptionsLabel => 'Pinned';
497+
498+
@override
499+
String get unpinnedSubscriptionsLabel => 'Unpinned';
500+
501+
@override
502+
String get noSubscriptions => 'No channels found';
503+
495504
@override
496505
String get notifSelfUser => 'Вы';
497506

lib/generated/l10n/zulip_localizations_sk.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,15 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
492492
return '$senderFullName to you and $_temp0';
493493
}
494494

495+
@override
496+
String get pinnedSubscriptionsLabel => 'Pinned';
497+
498+
@override
499+
String get unpinnedSubscriptionsLabel => 'Unpinned';
500+
501+
@override
502+
String get noSubscriptions => 'No channels found';
503+
495504
@override
496505
String get notifSelfUser => 'Ty';
497506

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.recentDmConversationsPageTitle;
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.noSubscriptions,
132132
textAlign: TextAlign.center,
133133
style: TextStyle(
134134
color: designVariables.subscriptionListHeaderText,

0 commit comments

Comments
 (0)