Skip to content

Commit

Permalink
msglist: Add translations for dm recipient header labels
Browse files Browse the repository at this point in the history
  • Loading branch information
sirpengi committed Nov 29, 2023
1 parent d9effc9 commit 67875e1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
11 changes: 11 additions & 0 deletions assets/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,17 @@
"filename": {"type": "String", "example": "file.txt"}
}
},
"messageListGroupYouAndOthers": "You and {others}",
"@messageListGroupYouAndOthers": {
"description": "Message list sticky header for a dm group with others.",
"placeholders": {
"others": {"type": "String", "example": "Alice, Bob"}
}
},
"messageListGroupYouWithYourself": "You with yourself",
"@messageListGroupYouWithYourself": {
"description": "Message list sticky header for a dm group that only includes yourself."
},
"contentValidationErrorTooLong": "Message length shouldn't be greater than 10000 characters.",
"@contentValidationErrorTooLong": {
"description": "Content validation error message when the message is too long."
Expand Down
9 changes: 5 additions & 4 deletions lib/widgets/message_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -651,17 +651,18 @@ class DmRecipientHeader extends StatelessWidget {

@override
Widget build(BuildContext context) {
final zulipLocalizations = ZulipLocalizations.of(context);
final store = PerAccountStoreWidget.of(context);
final String title;
if (message.allRecipientIds.length > 1) {
final otherNames = message.allRecipientIds
title = zulipLocalizations.messageListGroupYouAndOthers(message.allRecipientIds
.where((id) => id != store.account.userId)
.map((id) => store.users[id]?.fullName ?? '(unknown user)')
.sorted()
.join(", ");
title = 'You and $otherNames';
.join(", "));
} else {
title = 'You with yourself'; // TODO pick string; web has glitchy "You and $yourname"
// TODO pick string; web has glitchy "You and $yourname"
title = zulipLocalizations.messageListGroupYouWithYourself;
}

return GestureDetector(
Expand Down

0 comments on commit 67875e1

Please sign in to comment.