Skip to content

Commit

Permalink
set status string message to translatable
Browse files Browse the repository at this point in the history
  • Loading branch information
gounux committed Jul 24, 2024
1 parent c83569c commit d3d02e9
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions qtribu/gui/dck_qchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,18 @@ def on_status_button_clicked(self) -> None:
"""
try:
status = self.qchat_client.get_status()
text = """Status: {status}
user_txt = self.tr("user")
text = self.tr(
"""Status: {status}
Rooms:
{rooms_status}""".format(
{rooms_status}"""
).format(
status=status["status"],
rooms_status="\n".join(
[
f"- {r['name']} : {r['nb_connected_users']} user{'s' if r['nb_connected_users'] > 1 else ''}"
f"- {r['name']} : {r['nb_connected_users']} {user_txt}{'s' if r['nb_connected_users'] > 1 else ''}"
for r in status["rooms"]
]
),
Expand Down Expand Up @@ -364,9 +368,9 @@ def handle_internal_message(self, message: dict[str, Any]) -> None:
if "nb_users" in message:
nb_users = message["nb_users"]
self.grb_qchat.setTitle(
self.tr("QChat - {nb_users} user{suffix}").format(
self.tr("QChat - {nb_users} {user_txt}").format(
nb_users=nb_users,
suffix="" if nb_users <= 1 else "s",
user_txt=self.tr("user") if nb_users <= 1 else self.tr("users"),
)
)

Expand Down

0 comments on commit d3d02e9

Please sign in to comment.