Skip to content

Commit 76425ed

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

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

lib/widgets/emoji_reaction.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ class ReactionChip extends StatelessWidget {
147147
@override
148148
Widget build(BuildContext context) {
149149
final store = PerAccountStoreWidget.of(context);
150+
final zulipLocalizations = ZulipLocalizations.of(context);
150151

151152
final reactionType = reactionWithVotes.reactionType;
152153
final emojiCode = reactionWithVotes.emojiCode;
@@ -161,7 +162,7 @@ class ReactionChip extends StatelessWidget {
161162
? userIds.map((id) {
162163
return id == store.selfUserId
163164
? 'You'
164-
: store.users[id]?.fullName ?? '(unknown user)'; // TODO(i18n)
165+
: store.users[id]?.fullName ?? zulipLocalizations.unknownUserName;
165166
}).join(', ')
166167
: userIds.length.toString();
167168

lib/widgets/inbox.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,16 +384,20 @@ class _DmItem extends StatelessWidget {
384384
final store = PerAccountStoreWidget.of(context);
385385
final selfUser = store.users[store.selfUserId]!;
386386

387+
final zulipLocalizations = ZulipLocalizations.of(context);
387388
final designVariables = DesignVariables.of(context);
388389

389390
final title = switch (narrow.otherRecipientIds) { // TODO dedupe with [RecentDmConversationsItem]
390391
[] => selfUser.fullName,
391-
[var otherUserId] => store.users[otherUserId]?.fullName ?? '(unknown user)',
392+
[var otherUserId] =>
393+
store.users[otherUserId]?.fullName ?? zulipLocalizations.unknownUserName,
392394

393395
// TODO(i18n): List formatting, like you can do in JavaScript:
394396
// new Intl.ListFormat('ja').format(['Chris', 'Greg', 'Alya', 'Shu'])
395397
// // 'Chris、Greg、Alya、Shu'
396-
_ => narrow.otherRecipientIds.map((id) => store.users[id]?.fullName ?? '(unknown user)').join(', '),
398+
_ => narrow.otherRecipientIds.map(
399+
(id) => store.users[id]?.fullName ?? zulipLocalizations.unknownUserName
400+
).join(', '),
397401
};
398402

399403
return Material(

lib/widgets/message_list.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,8 @@ class MessageListAppBarTitle extends StatelessWidget {
415415
if (otherRecipientIds.isEmpty) {
416416
return Text(zulipLocalizations.dmsWithYourselfPageTitle);
417417
} else {
418-
final names = otherRecipientIds.map((id) => store.users[id]?.fullName ?? '(unknown user)');
418+
final names = otherRecipientIds.map(
419+
(id) => store.users[id]?.fullName ?? zulipLocalizations.unknownUserName);
419420
return Text("DMs with ${names.join(", ")}"); // TODO show avatars
420421
}
421422
}

lib/widgets/profile.dart

Lines changed: 2 additions & 1 deletion
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,

lib/widgets/recent_dm_conversations.dart

Lines changed: 6 additions & 2 deletions
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)