Skip to content

content: Add localized rendering of system-group names in @-mentions#2175

Merged
gnprice merged 1 commit intozulip:mainfrom
Ruhdee:issue-1260
Feb 27, 2026
Merged

content: Add localized rendering of system-group names in @-mentions#2175
gnprice merged 1 commit intozulip:mainfrom
Ruhdee:issue-1260

Conversation

@Ruhdee
Copy link
Contributor

@Ruhdee Ruhdee commented Feb 24, 2026

Fixes #1260.

Before After
Screenshot_20260224-213442 Zulip Screenshot_20260224-200945 Zulip
Screenshot_20260224-213456 Zulip Screenshot_20260224-200955 Zulip

Changes made:

  1. Added system group name strings to app_en.arb.
  2. Added function displayName to SystemGroupName to get translated string for current system group.
  3. Changed Mention widget to fetch system group display name using the current user group mention name (treating the name as api value). If the system group doesn't exist, it falls back to the user group mention name.
  4. Added tests.

@gnprice gnprice added the maintainer review PR ready for review by Zulip maintainers label Feb 24, 2026
Copy link
Collaborator

@chrisbobbe chrisbobbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Small comments below.

Comment on lines +357 to +375
/// Get the display name to use in the UI for this system group.
String displayName(ZulipLocalizations zulipLocalizations) => switch (this) {
SystemGroupName.everyoneOnInternet =>
zulipLocalizations.systemGroupNameEveryoneOnInternet,
SystemGroupName.everyone =>
zulipLocalizations.systemGroupNameEveryoneIncludingGuests,
SystemGroupName.members =>
zulipLocalizations.systemGroupNameEveryoneExceptGuests,
SystemGroupName.fullMembers =>
zulipLocalizations.systemGroupNameFullMembers,
SystemGroupName.moderators =>
zulipLocalizations.systemGroupNameModerators,
SystemGroupName.administrators =>
zulipLocalizations.systemGroupNameAdministrators,
SystemGroupName.owners =>
zulipLocalizations.systemGroupNameOwners,
SystemGroupName.nobody =>
zulipLocalizations.systemGroupNameNobody,
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these particular display names chosen? Is there API documentation you can link to in the dartdoc, so it's clear for people reading this code later?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API docs contain a general description/explanation of the system roles, but do not contain the particular strings used in the web app code. I will add a dartdoc comment saying that the strings are taken from the web app code.

Comment on lines 1204 to 1209
if (userGroup case UserGroup(:final name)) {
// TODO(#1260) Get display name for system groups using localization
nodes = [TextNode(node.isSilent ? name : '@$name')];
final displayName = SystemGroupName.fromJson(name)
?.displayName(ZulipLocalizations.of(context)) ?? name;
nodes = [TextNode(node.isSilent ? displayName : '@$displayName')];
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do an explicit check on isSystemGroup, for example like this:

        if (userGroup case UserGroup(:final name, :final isSystemGroup)) {
          final String displayName;
          if (isSystemGroup) {
            final groupName = SystemGroupName.fromJson(name); // TODO(log) if null
            displayName = groupName?.displayName(zulipLocalizations) ?? name;
          } else {
            displayName = name;
          }

          nodes = [TextNode(node.isSilent ? displayName : '@$displayName')];
        }

@Ruhdee
Copy link
Contributor Author

Ruhdee commented Feb 25, 2026

@chrisbobbe I have addressed the feedback. PTAL!

@Ruhdee
Copy link
Contributor Author

Ruhdee commented Feb 25, 2026

Small change:
Created a separate localizations object variable in Mention widget to be more in line with your code and the docs:
https://github.com/zulip/zulip-flutter/blob/main/docs/translation.md#using-a-translated-string-in-the-code

Copy link
Collaborator

@chrisbobbe chrisbobbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! One nit below, and I'll mark for Greg's review.

Comment on lines +364 to +367
SystemGroupName.everyone =>
zulipLocalizations.systemGroupNameEveryoneIncludingGuests,
SystemGroupName.members =>
zulipLocalizations.systemGroupNameEveryoneExceptGuests,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's name the UI strings more closely with the API values they correspond to:

  • zulipLocalizations.systemGroupNameEveryone
  • zulipLocalizations.systemGroupNameMembers

@chrisbobbe chrisbobbe added integration review Added by maintainers when PR may be ready for integration and removed maintainer review PR ready for review by Zulip maintainers labels Feb 25, 2026
@chrisbobbe chrisbobbe requested a review from gnprice February 25, 2026 19:22
@gnprice
Copy link
Member

gnprice commented Feb 25, 2026

Thanks! Looks great except the one nit Chris mentioned above.

@Ruhdee Ruhdee force-pushed the issue-1260 branch 3 times, most recently from 38c0ffd to de6b43b Compare February 25, 2026 21:32
@Ruhdee
Copy link
Contributor Author

Ruhdee commented Feb 25, 2026

I have renamed the strings and rebased onto main (the latest commit on main caused merge conflicts). PTAL!

@Ruhdee
Copy link
Contributor Author

Ruhdee commented Feb 26, 2026

Update:
Added summary in commit message.

Update 2:
Added direct link to web app code in commit message, extrapolating the suggestions from #2168 (comment) and #2168 (comment).

@gnprice
Copy link
Member

gnprice commented Feb 27, 2026

Thanks for the revisions! Looks good; merging.

Those additions to the commit message are helpful, good thought.

Fixes zulip#1260.

System group names in @-mentions are now rendered using localized
strings. These strings match the strings used in the web app code:
  https://github.com/zulip/zulip/blob/81e0305f9/web/src/settings_config.ts#L1242

Previously, the raw api values returned by the server were shown in
system group @-mentions.
@gnprice gnprice merged commit 84f0994 into zulip:main Feb 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration review Added by maintainers when PR may be ready for integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle system-group names in rendering @-mentions

3 participants