Skip to content

Commit

Permalink
Sweep for non-localized '(unknown channel)' strings
Browse files Browse the repository at this point in the history
Renamed the label to generalize it

Signed-off-by: Zixuan James Li <[email protected]>
  • Loading branch information
PIG208 committed Dec 12, 2024
1 parent d809507 commit 9e9db9b
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 15 deletions.
12 changes: 10 additions & 2 deletions assets/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@
"@composeBoxSendTooltip": {
"description": "Tooltip for send button in compose box."
},
"composeBoxUnknownChannelName": "(unknown channel)",
"@composeBoxUnknownChannelName": {
"unknownChannelName": "(unknown channel)",
"@unknownChannelName": {
"description": "Replacement name for channel when it cannot be found in the store."
},
"composeBoxTopicHintText": "Topic",
Expand Down Expand Up @@ -618,6 +618,14 @@
"@channelFeedButtonTooltip": {
"description": "Tooltip for button to navigate to a given channel's feed"
},
"notifChannelConversationLabel": "#{channel} > {topic}",
"@notifChannelConversationLabel": {
"description": "Label for a channel conversation notification.",
"placeholders": {
"channel": {"type": "String", "example": "channel name"},
"topic": {"type": "String", "example": "topic name"}
}
},
"notifGroupDmConversationLabel": "{senderFullName} to you and {numOthers, plural, =1{1 other} other{{numOthers} others}}",
"@notifGroupDmConversationLabel": {
"description": "Label for a group DM conversation notification.",
Expand Down
8 changes: 7 additions & 1 deletion lib/generated/l10n/zulip_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ abstract class ZulipLocalizations {
///
/// In en, this message translates to:
/// **'(unknown channel)'**
String get composeBoxUnknownChannelName;
String get unknownChannelName;

/// Hint text for topic input widget in compose box.
///
Expand Down Expand Up @@ -937,6 +937,12 @@ abstract class ZulipLocalizations {
/// **'Channel feed'**
String get channelFeedButtonTooltip;

/// Label for a channel conversation notification.
///
/// In en, this message translates to:
/// **'#{channel} > {topic}'**
String notifChannelConversationLabel(String channel, String topic);

/// Label for a group DM conversation notification.
///
/// In en, this message translates to:
Expand Down
7 changes: 6 additions & 1 deletion lib/generated/l10n/zulip_localizations_ar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
String get composeBoxSendTooltip => 'Send';

@override
String get composeBoxUnknownChannelName => '(unknown channel)';
String get unknownChannelName => '(unknown channel)';

@override
String get composeBoxTopicHintText => 'Topic';
Expand Down Expand Up @@ -487,6 +487,11 @@ class ZulipLocalizationsAr extends ZulipLocalizations {
@override
String get channelFeedButtonTooltip => 'Channel feed';

@override
String notifChannelConversationLabel(String channel, String topic) {
return '#$channel > $topic';
}

@override
String notifGroupDmConversationLabel(String senderFullName, int numOthers) {
String _temp0 = intl.Intl.pluralLogic(
Expand Down
7 changes: 6 additions & 1 deletion lib/generated/l10n/zulip_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
String get composeBoxSendTooltip => 'Send';

@override
String get composeBoxUnknownChannelName => '(unknown channel)';
String get unknownChannelName => '(unknown channel)';

@override
String get composeBoxTopicHintText => 'Topic';
Expand Down Expand Up @@ -487,6 +487,11 @@ class ZulipLocalizationsEn extends ZulipLocalizations {
@override
String get channelFeedButtonTooltip => 'Channel feed';

@override
String notifChannelConversationLabel(String channel, String topic) {
return '#$channel > $topic';
}

@override
String notifGroupDmConversationLabel(String senderFullName, int numOthers) {
String _temp0 = intl.Intl.pluralLogic(
Expand Down
7 changes: 6 additions & 1 deletion lib/generated/l10n/zulip_localizations_fr.dart
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class ZulipLocalizationsFr extends ZulipLocalizations {
String get composeBoxSendTooltip => 'Send';

@override
String get composeBoxUnknownChannelName => '(unknown channel)';
String get unknownChannelName => '(unknown channel)';

@override
String get composeBoxTopicHintText => 'Topic';
Expand Down Expand Up @@ -487,6 +487,11 @@ class ZulipLocalizationsFr extends ZulipLocalizations {
@override
String get channelFeedButtonTooltip => 'Channel feed';

@override
String notifChannelConversationLabel(String channel, String topic) {
return '#$channel > $topic';
}

@override
String notifGroupDmConversationLabel(String senderFullName, int numOthers) {
String _temp0 = intl.Intl.pluralLogic(
Expand Down
7 changes: 6 additions & 1 deletion lib/generated/l10n/zulip_localizations_ja.dart
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
String get composeBoxSendTooltip => 'Send';

@override
String get composeBoxUnknownChannelName => '(unknown channel)';
String get unknownChannelName => '(unknown channel)';

@override
String get composeBoxTopicHintText => 'Topic';
Expand Down Expand Up @@ -487,6 +487,11 @@ class ZulipLocalizationsJa extends ZulipLocalizations {
@override
String get channelFeedButtonTooltip => 'Channel feed';

@override
String notifChannelConversationLabel(String channel, String topic) {
return '#$channel > $topic';
}

@override
String notifGroupDmConversationLabel(String senderFullName, int numOthers) {
String _temp0 = intl.Intl.pluralLogic(
Expand Down
7 changes: 6 additions & 1 deletion lib/generated/l10n/zulip_localizations_pl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
String get composeBoxSendTooltip => 'Wyślij';

@override
String get composeBoxUnknownChannelName => '(nieznany kanał)';
String get unknownChannelName => '(unknown channel)';

@override
String get composeBoxTopicHintText => 'Wątek';
Expand Down Expand Up @@ -487,6 +487,11 @@ class ZulipLocalizationsPl extends ZulipLocalizations {
@override
String get channelFeedButtonTooltip => 'Strumień kanału';

@override
String notifChannelConversationLabel(String channel, String topic) {
return '#$channel > $topic';
}

@override
String notifGroupDmConversationLabel(String senderFullName, int numOthers) {
String _temp0 = intl.Intl.pluralLogic(
Expand Down
7 changes: 6 additions & 1 deletion lib/generated/l10n/zulip_localizations_ru.dart
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
String get composeBoxSendTooltip => 'Send';

@override
String get composeBoxUnknownChannelName => '(unknown channel)';
String get unknownChannelName => '(unknown channel)';

@override
String get composeBoxTopicHintText => 'Topic';
Expand Down Expand Up @@ -487,6 +487,11 @@ class ZulipLocalizationsRu extends ZulipLocalizations {
@override
String get channelFeedButtonTooltip => 'Channel feed';

@override
String notifChannelConversationLabel(String channel, String topic) {
return '#$channel > $topic';
}

@override
String notifGroupDmConversationLabel(String senderFullName, int numOthers) {
String _temp0 = intl.Intl.pluralLogic(
Expand Down
5 changes: 3 additions & 2 deletions lib/notifications/display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,10 @@ class NotificationDisplayManager {
// the first.
messagingStyle.conversationTitle = switch (data.recipient) {
FcmMessageChannelRecipient(:var streamName?, :var topic) =>
'#$streamName > $topic',
zulipLocalizations.notifChannelConversationLabel(streamName, topic),
FcmMessageChannelRecipient(:var topic) =>
'#(unknown channel) > $topic', // TODO get stream name from data
zulipLocalizations.notifChannelConversationLabel(
zulipLocalizations.unknownChannelName, topic), // TODO get stream name from data
FcmMessageDmRecipient(:var allRecipientIds) when allRecipientIds.length > 2 =>
zulipLocalizations.notifGroupDmConversationLabel(
data.senderFullName, allRecipientIds.length - 2), // TODO use others' names, from data
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/compose_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ class _StreamContentInputState extends State<_StreamContentInput> {
final store = PerAccountStoreWidget.of(context);
final zulipLocalizations = ZulipLocalizations.of(context);
final streamName = store.streams[widget.narrow.streamId]?.name
?? zulipLocalizations.composeBoxUnknownChannelName;
?? zulipLocalizations.unknownChannelName;
return _ContentInput(
narrow: widget.narrow,
destination: TopicNarrow(widget.narrow.streamId, _topicTextNormalized),
Expand Down Expand Up @@ -545,7 +545,7 @@ class _FixedDestinationContentInput extends StatelessWidget {
case TopicNarrow(:final streamId, :final topic):
final store = PerAccountStoreWidget.of(context);
final streamName = store.streams[streamId]?.name
?? zulipLocalizations.composeBoxUnknownChannelName;
?? zulipLocalizations.unknownChannelName;
return zulipLocalizations.composeBoxChannelContentHint(streamName, topic);

case DmNarrow(otherRecipientIds: []): // The self-1:1 thread.
Expand Down
7 changes: 5 additions & 2 deletions lib/widgets/message_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ class MessageListAppBarTitle extends StatelessWidget {
Widget _buildStreamRow(BuildContext context, {
ZulipStream? stream,
}) {
final zulipLocalizations = ZulipLocalizations.of(context);
// A null [Icon.icon] makes a blank space.
final icon = stream != null ? iconDataForStream(stream) : null;
return Row(
Expand All @@ -328,7 +329,8 @@ class MessageListAppBarTitle extends StatelessWidget {
children: [
Icon(size: 16, icon),
const SizedBox(width: 4),
Flexible(child: Text(stream?.name ?? '(unknown channel)')),
Flexible(child: Text(
stream?.name ?? zulipLocalizations.unknownChannelName)),
]);
}

Expand Down Expand Up @@ -1028,6 +1030,7 @@ class StreamMessageRecipientHeader extends StatelessWidget {
// https://github.com/zulip/zulip-mobile/issues/5511
final store = PerAccountStoreWidget.of(context);
final designVariables = DesignVariables.of(context);
final zulipLocalizations = ZulipLocalizations.of(context);

final topic = message.topic;

Expand All @@ -1052,7 +1055,7 @@ class StreamMessageRecipientHeader extends StatelessWidget {
final stream = store.streams[message.streamId];
final streamName = stream?.name
?? message.displayRecipient
?? '(unknown channel)'; // TODO(log)
?? zulipLocalizations.unknownChannelName; // TODO(log)

streamWidget = GestureDetector(
onTap: () => Navigator.push(context,
Expand Down

0 comments on commit 9e9db9b

Please sign in to comment.