[Mod] Pluralize properly in userinfo (#4397)

* Pluralize properly in userinfo

* black

* totally didn't forget roles

* Almost seems like you have a point there...

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Yes... right... this one too

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

* Yes, yes we do.

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
Dav 2020-09-20 22:39:44 +00:00 committed by GitHub
parent 47d9069108
commit d7da0b4081
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -245,15 +245,25 @@ class ModInfo(MixinMeta):
data.add_field(name=_("Joined Discord on"), value=created_on) data.add_field(name=_("Joined Discord on"), value=created_on)
data.add_field(name=_("Joined this server on"), value=joined_on) data.add_field(name=_("Joined this server on"), value=joined_on)
if role_str is not None: if role_str is not None:
data.add_field(name=_("Roles"), value=role_str, inline=False) data.add_field(
name=_("Roles") if len(roles) > 1 else _("Role"), value=role_str, inline=False
)
if names: if names:
# May need sanitizing later, but mentions do not ping in embeds currently # May need sanitizing later, but mentions do not ping in embeds currently
val = filter_invites(", ".join(names)) val = filter_invites(", ".join(names))
data.add_field(name=_("Previous Names"), value=val, inline=False) data.add_field(
name=_("Previous Names") if len(names) > 1 else _("Previous Name"),
value=val,
inline=False,
)
if nicks: if nicks:
# May need sanitizing later, but mentions do not ping in embeds currently # May need sanitizing later, but mentions do not ping in embeds currently
val = filter_invites(", ".join(nicks)) val = filter_invites(", ".join(nicks))
data.add_field(name=_("Previous Nicknames"), value=val, inline=False) data.add_field(
name=_("Previous Nicknames") if len(nicks) > 1 else _("Previous Nickname"),
value=val,
inline=False,
)
if voice_state and voice_state.channel: if voice_state and voice_state.channel:
data.add_field( data.add_field(
name=_("Current voice channel"), name=_("Current voice channel"),