Skip to content

Commit

Permalink
inbox: Make header titles localizable
Browse files Browse the repository at this point in the history
The comment started with "Strings here left unlocalized"
was from zulip#397, which followed an old design:
  https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=171-12359&t=ilEg6ymsxO6JLNQ5-0
Since we have now translated these strings, this is no longer true.

Signed-off-by: Zixuan James Li <zixuan@zulip.com>
  • Loading branch information
PIG208 committed Jan 31, 2025
1 parent 00bd5b9 commit 23f7aa3
Show file tree
Hide file tree
Showing 11 changed files with 138 additions and 10 deletions.
16 changes: 16 additions & 0 deletions assets/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,10 @@
"@recentDmConversationsPageTitle": {
"description": "Title for the page with a list of DM conversations."
},
"recentDmConversationsSectionHeader": "Direct messages",
"@recentDmConversationsSectionHeader": {
"description": "Heading for direct messages section on the 'Inbox' message view."
},
"combinedFeedPageTitle": "Combined feed",
"@combinedFeedPageTitle": {
"description": "Page title for the 'Combined feed' message view."
Expand Down Expand Up @@ -618,6 +622,18 @@
"numOthers": {"type": "int", "example": "4"}
}
},
"pinnedSubscriptionsLabel": "Pinned",
"@pinnedSubscriptionsLabel": {
"description": "Label for the list of pinned subscribed channels."
},
"unpinnedSubscriptionsLabel": "Unpinned",
"@unpinnedSubscriptionsLabel": {
"description": "Label for the list of unpinned subscribed channels."
},
"subscriptionListNoChannels": "No channels found",
"@subscriptionListNoChannels": {
"description": "Text to display on subscribed-channels page when there are no subscribed channels."
},
"notifSelfUser": "You",
"@notifSelfUser": {
"description": "Display name for the user themself, to show after replying in an Android notification"
Expand Down
24 changes: 24 additions & 0 deletions lib/generated/l10n/zulip_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,12 @@ abstract class ZulipLocalizations {
/// **'Direct messages'**
String get recentDmConversationsPageTitle;

/// Heading for direct messages section on the 'Inbox' message view.
///
/// In en, this message translates to:
/// **'Direct messages'**
String get recentDmConversationsSectionHeader;

/// Page title for the 'Combined feed' message view.
///
/// In en, this message translates to:
Expand Down Expand Up @@ -933,6 +939,24 @@ abstract class ZulipLocalizations {
/// **'{senderFullName} to you and {numOthers, plural, =1{1 other} other{{numOthers} others}}'**
String notifGroupDmConversationLabel(String senderFullName, int numOthers);

/// Label for the list of pinned subscribed channels.
///
/// In en, this message translates to:
/// **'Pinned'**
String get pinnedSubscriptionsLabel;

/// Label for the list of unpinned subscribed channels.
///
/// In en, this message translates to:
/// **'Unpinned'**
String get unpinnedSubscriptionsLabel;

/// Text to display on subscribed-channels page when there are no subscribed channels.
///
/// In en, this message translates to:
/// **'No channels found'**
String get subscriptionListNoChannels;

/// Display name for the user themself, to show after replying in an Android notification
///
/// In en, this message translates to:
Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations_ar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,9 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
@override
String get recentDmConversationsPageTitle => 'Direct messages';

@override
String get recentDmConversationsSectionHeader => 'Direct messages';

@override
String get combinedFeedPageTitle => 'Combined feed';

Expand Down Expand Up @@ -492,6 +495,15 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
return '$senderFullName to you and $_temp0';
}

@override
String get pinnedSubscriptionsLabel => 'Pinned';

@override
String get unpinnedSubscriptionsLabel => 'Unpinned';

@override
String get subscriptionListNoChannels => 'No channels found';

@override
String get notifSelfUser => 'You';

Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,9 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
@override
String get recentDmConversationsPageTitle => 'Direct messages';

@override
String get recentDmConversationsSectionHeader => 'Direct messages';

@override
String get combinedFeedPageTitle => 'Combined feed';

Expand Down Expand Up @@ -492,6 +495,15 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
return '$senderFullName to you and $_temp0';
}

@override
String get pinnedSubscriptionsLabel => 'Pinned';

@override
String get unpinnedSubscriptionsLabel => 'Unpinned';

@override
String get subscriptionListNoChannels => 'No channels found';

@override
String get notifSelfUser => 'You';

Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations_ja.dart
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,9 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
@override
String get recentDmConversationsPageTitle => 'Direct messages';

@override
String get recentDmConversationsSectionHeader => 'Direct messages';

@override
String get combinedFeedPageTitle => 'Combined feed';

Expand Down Expand Up @@ -492,6 +495,15 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
return '$senderFullName to you and $_temp0';
}

@override
String get pinnedSubscriptionsLabel => 'Pinned';

@override
String get unpinnedSubscriptionsLabel => 'Unpinned';

@override
String get subscriptionListNoChannels => 'No channels found';

@override
String get notifSelfUser => 'You';

Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations_nb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,9 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
@override
String get recentDmConversationsPageTitle => 'Direct messages';

@override
String get recentDmConversationsSectionHeader => 'Direct messages';

@override
String get combinedFeedPageTitle => 'Combined feed';

Expand Down Expand Up @@ -492,6 +495,15 @@ class ZulipLocalizationsNb extends ZulipLocalizations {
return '$senderFullName to you and $_temp0';
}

@override
String get pinnedSubscriptionsLabel => 'Pinned';

@override
String get unpinnedSubscriptionsLabel => 'Unpinned';

@override
String get subscriptionListNoChannels => 'No channels found';

@override
String get notifSelfUser => 'You';

Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations_pl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,9 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
@override
String get recentDmConversationsPageTitle => 'Wiadomości bezpośrednie';

@override
String get recentDmConversationsSectionHeader => 'Direct messages';

@override
String get combinedFeedPageTitle => 'Mieszany widok';

Expand Down Expand Up @@ -492,6 +495,15 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
return '$senderFullName do ciebie i $_temp0';
}

@override
String get pinnedSubscriptionsLabel => 'Pinned';

@override
String get unpinnedSubscriptionsLabel => 'Unpinned';

@override
String get subscriptionListNoChannels => 'No channels found';

@override
String get notifSelfUser => 'Ty';

Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations_ru.dart
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,9 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
@override
String get recentDmConversationsPageTitle => 'Личные сообщения';

@override
String get recentDmConversationsSectionHeader => 'Direct messages';

@override
String get combinedFeedPageTitle => 'Объединенная лента';

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

@override
String get pinnedSubscriptionsLabel => 'Pinned';

@override
String get unpinnedSubscriptionsLabel => 'Unpinned';

@override
String get subscriptionListNoChannels => 'No channels found';

@override
String get notifSelfUser => 'Вы';

Expand Down
12 changes: 12 additions & 0 deletions lib/generated/l10n/zulip_localizations_sk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,9 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
@override
String get recentDmConversationsPageTitle => 'Priama správa';

@override
String get recentDmConversationsSectionHeader => 'Direct messages';

@override
String get combinedFeedPageTitle => 'Zlúčený kanál';

Expand Down Expand Up @@ -492,6 +495,15 @@ class ZulipLocalizationsSk extends ZulipLocalizations {
return '$senderFullName to you and $_temp0';
}

@override
String get pinnedSubscriptionsLabel => 'Pinned';

@override
String get unpinnedSubscriptionsLabel => 'Unpinned';

@override
String get subscriptionListNoChannels => 'No channels found';

@override
String get notifSelfUser => 'Ty';

Expand Down
12 changes: 8 additions & 4 deletions lib/widgets/inbox.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';

import '../api/model/model.dart';
import '../generated/l10n/zulip_localizations.dart';
import '../model/narrow.dart';
import '../model/recent_dm_conversations.dart';
import '../model/unreads.dart';
Expand Down Expand Up @@ -237,7 +238,7 @@ abstract class _HeaderItem extends StatelessWidget {
required this.sectionContext,
});

String get title;
String title(ZulipLocalizations zulipLocalizations);
IconData get icon;
Color collapsedIconColor(BuildContext context);
Color uncollapsedIconColor(BuildContext context);
Expand All @@ -257,6 +258,7 @@ abstract class _HeaderItem extends StatelessWidget {

@override
Widget build(BuildContext context) {
final zulipLocalizations = ZulipLocalizations.of(context);
final designVariables = DesignVariables.of(context);
return Material(
color: collapsed
Expand Down Expand Up @@ -291,7 +293,7 @@ abstract class _HeaderItem extends StatelessWidget {
).merge(weightVariableTextStyle(context, wght: 600)),
maxLines: 1,
overflow: TextOverflow.ellipsis,
title))),
title(zulipLocalizations)))),
const SizedBox(width: 12),
if (hasMention) const _IconMarker(icon: ZulipIcons.at_sign),
Padding(padding: const EdgeInsetsDirectional.only(end: 16),
Expand All @@ -312,7 +314,8 @@ class _AllDmsHeaderItem extends _HeaderItem {
required super.sectionContext,
});

@override String get title => 'Direct messages'; // TODO(i18n)
@override String title(ZulipLocalizations zulipLocalizations) =>
zulipLocalizations.recentDmConversationsSectionHeader;
@override IconData get icon => ZulipIcons.user;

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

@override String get title => subscription.name;
@override String title(ZulipLocalizations zulipLocalizations) =>
subscription.name;
@override IconData get icon => iconDataForStream(subscription);
@override Color collapsedIconColor(context) =>
colorSwatchFor(context, subscription).iconOnPlainBackground;
Expand Down
12 changes: 6 additions & 6 deletions lib/widgets/subscription_list.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';

import '../api/model/model.dart';
import '../generated/l10n/zulip_localizations.dart';
import '../model/narrow.dart';
import '../model/unreads.dart';
import 'icons.dart';
Expand Down Expand Up @@ -77,10 +78,8 @@ class _SubscriptionListPageBodyState extends State<SubscriptionListPageBody> wit

// TODO: Implement collapsible topics

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

final List<Subscription> pinned = [];
final List<Subscription> unpinned = [];
Expand All @@ -102,11 +101,11 @@ class _SubscriptionListPageBodyState extends State<SubscriptionListPageBody> wit
if (pinned.isEmpty && unpinned.isEmpty)
const _NoSubscriptionsItem(),
if (pinned.isNotEmpty) ...[
const _SubscriptionListHeader(label: "Pinned"),
_SubscriptionListHeader(label: zulipLocalizations.pinnedSubscriptionsLabel),
_SubscriptionList(unreadsModel: unreadsModel, subscriptions: pinned),
],
if (unpinned.isNotEmpty) ...[
const _SubscriptionListHeader(label: "Unpinned"),
_SubscriptionListHeader(label: zulipLocalizations.unpinnedSubscriptionsLabel),
_SubscriptionList(unreadsModel: unreadsModel, subscriptions: unpinned),
],

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

return SliverToBoxAdapter(
child: Padding(
padding: const EdgeInsets.all(10),
child: Text("No channels found",
child: Text(zulipLocalizations.subscriptionListNoChannels,
textAlign: TextAlign.center,
style: TextStyle(
color: designVariables.subscriptionListHeaderText,
Expand Down

0 comments on commit 23f7aa3

Please sign in to comment.