From ca7a9e6b98fec4ffcc0a2160875e589a50805de4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Jakse?= Date: Fri, 8 Aug 2025 08:56:05 +0200 Subject: [PATCH] #22: fix bad assigment and add a chat message to warn about name change --- l10n/po/fr/trivabble.po | 3 +++ l10n/pot/trivabble.pot | 3 +++ public/trivabble.js | 5 +++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/l10n/po/fr/trivabble.po b/l10n/po/fr/trivabble.po index 80e150c..4306a19 100644 --- a/l10n/po/fr/trivabble.po +++ b/l10n/po/fr/trivabble.po @@ -307,6 +307,9 @@ msgstr "Désolé, ce serveur ne prend pas en charge le changement de nom." msgid "Could not change your name. Please check that it's not already used by someone else!" msgstr "Impossible de changer votre nom. Veuillez vérifier que personne n’utilise déjà ce nom !" +msgid "{0} changed their name to {1}" +msgstr "{0} a changé son nom : {1}" + msgid "joker" msgstr "joker" diff --git a/l10n/pot/trivabble.pot b/l10n/pot/trivabble.pot index 892cf05..98d1812 100644 --- a/l10n/pot/trivabble.pot +++ b/l10n/pot/trivabble.pot @@ -313,6 +313,9 @@ msgstr "" msgid "Could not change your name. Please check that it's not already used by someone else!" msgstr "" +msgid "{0} changed their name to {1}" +msgstr "" + msgid "joker" msgstr "" diff --git a/public/trivabble.js b/public/trivabble.js index 12d2b06..5f53c79 100644 --- a/public/trivabble.js +++ b/public/trivabble.js @@ -1133,7 +1133,7 @@ const newName = player.newName; tablePlayers[newName] = tablePlayers[playerName]; delete tablePlayers[playerName]; - playerNameCell = tablePlayers[playerName].querySelector("td"); + const playerNameCell = tablePlayers[newName].querySelector("td"); playerNameCell.textContent = newName; if (playerName == getSetting("PlayerName")) { setSetting("PlayerName", newName); @@ -1141,6 +1141,7 @@ } else { blink(playerNameCell); } + chatMessage("", format(_("{0} changed their name to {1}"), playerName, newName)); } } @@ -1239,7 +1240,7 @@ if (data.error) { if (cmdName === "changePlayerName") { - alert(_("Could not change your name. Please check that it's not already used by someone else!"); + alert(_("Could not change your name. Please check that it's not already used by someone else!")); } else { fatalError(new Error("Error from the server: " + data.error + " - " + data.reason)); } -- 2.30.2