Skip to content

Commit d809507

Browse files
committed
Sweep for non-localized '(unknown user)' strings
Signed-off-by: Zixuan James Li <[email protected]>
1 parent b6e1bf8 commit d809507

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

Diff for: lib/widgets/emoji_reaction.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ class ReactionChip extends StatelessWidget {
149149
@override
150150
Widget build(BuildContext context) {
151151
final store = PerAccountStoreWidget.of(context);
152+
final zulipLocalizations = ZulipLocalizations.of(context);
152153

153154
final reactionType = reactionWithVotes.reactionType;
154155
final emojiCode = reactionWithVotes.emojiCode;
@@ -163,7 +164,7 @@ class ReactionChip extends StatelessWidget {
163164
? userIds.map((id) {
164165
return id == store.selfUserId
165166
? 'You'
166-
: store.users[id]?.fullName ?? '(unknown user)'; // TODO(i18n)
167+
: store.users[id]?.fullName ?? zulipLocalizations.unknownUserName;
167168
}).join(', ')
168169
: userIds.length.toString();
169170

Diff for: lib/widgets/inbox.dart

+6-2
Original file line numberDiff line numberDiff line change
@@ -365,16 +365,20 @@ class _DmItem extends StatelessWidget {
365365
final store = PerAccountStoreWidget.of(context);
366366
final selfUser = store.users[store.selfUserId]!;
367367

368+
final zulipLocalizations = ZulipLocalizations.of(context);
368369
final designVariables = DesignVariables.of(context);
369370

370371
final title = switch (narrow.otherRecipientIds) { // TODO dedupe with [RecentDmConversationsItem]
371372
[] => selfUser.fullName,
372-
[var otherUserId] => store.users[otherUserId]?.fullName ?? '(unknown user)',
373+
[var otherUserId] =>
374+
store.users[otherUserId]?.fullName ?? zulipLocalizations.unknownUserName,
373375

374376
// TODO(i18n): List formatting, like you can do in JavaScript:
375377
// new Intl.ListFormat('ja').format(['Chris', 'Greg', 'Alya', 'Shu'])
376378
// // 'Chris、Greg、Alya、Shu'
377-
_ => narrow.otherRecipientIds.map((id) => store.users[id]?.fullName ?? '(unknown user)').join(', '),
379+
_ => narrow.otherRecipientIds.map(
380+
(id) => store.users[id]?.fullName ?? zulipLocalizations.unknownUserName
381+
).join(', '),
378382
};
379383

380384
return Material(

Diff for: lib/widgets/message_list.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,8 @@ class MessageListAppBarTitle extends StatelessWidget {
422422
if (otherRecipientIds.isEmpty) {
423423
return Text(zulipLocalizations.messageListYouWithYourselfTitle);
424424
} else {
425-
final names = otherRecipientIds.map((id) => store.users[id]?.fullName ?? '(unknown user)');
425+
final names = otherRecipientIds.map(
426+
(id) => store.users[id]?.fullName ?? zulipLocalizations.unknownUserName);
426427
return Text("DMs with ${names.join(", ")}"); // TODO show avatars
427428
}
428429
}

Diff for: lib/widgets/profile.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,9 @@ class _UserWidget extends StatelessWidget {
291291
@override
292292
Widget build(BuildContext context) {
293293
final store = PerAccountStoreWidget.of(context);
294+
final zulipLocalizations = ZulipLocalizations.of(context);
294295
final user = store.users[userId];
295-
final fullName = user?.fullName ?? '(unknown user)';
296+
final fullName = user?.fullName ?? zulipLocalizations.unknownUserName;
296297
return InkWell(
297298
onTap: () => Navigator.push(context,
298299
ProfilePage.buildRoute(context: context,

Diff for: lib/widgets/recent_dm_conversations.dart

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:flutter/material.dart';
22

3+
import '../generated/l10n/zulip_localizations.dart';
34
import '../model/narrow.dart';
45
import '../model/recent_dm_conversations.dart';
56
import '../model/unreads.dart';
@@ -81,6 +82,7 @@ class RecentDmConversationsItem extends StatelessWidget {
8182
final store = PerAccountStoreWidget.of(context);
8283
final selfUser = store.users[store.selfUserId]!;
8384

85+
final zulipLocalizations = ZulipLocalizations.of(context);
8486
final designVariables = DesignVariables.of(context);
8587

8688
final String title;
@@ -94,13 +96,15 @@ class RecentDmConversationsItem extends StatelessWidget {
9496
// (should we offer a "spam folder" style summary screen of recent
9597
// 1:1 DM conversations from muted users?)
9698
final otherUser = store.users[otherUserId];
97-
title = otherUser?.fullName ?? '(unknown user)';
99+
title = otherUser?.fullName ?? zulipLocalizations.unknownUserName;
98100
avatar = AvatarImage(userId: otherUserId, size: _avatarSize);
99101
default:
100102
// TODO(i18n): List formatting, like you can do in JavaScript:
101103
// new Intl.ListFormat('ja').format(['Chris', 'Greg', 'Alya'])
102104
// // 'Chris、Greg、Alya'
103-
title = narrow.otherRecipientIds.map((id) => store.users[id]?.fullName ?? '(unknown user)').join(', ');
105+
title = narrow.otherRecipientIds.map(
106+
(id) => store.users[id]?.fullName ?? zulipLocalizations.unknownUserName
107+
).join(', ');
104108
avatar = ColoredBox(color: designVariables.groupDmConversationIconBg,
105109
child: Center(
106110
child: Icon(color: designVariables.groupDmConversationIcon,

0 commit comments

Comments
 (0)