Ticket #3570: 3570.7.diff

File 3570.7.diff, 3.9 KB (added by stanislas69, 2 years ago)

grammar fix.

  • binaries/data/mods/public/gui/common/network.js

     
    4646/**
    4747 * Must be kept in sync with source/network/NetHost.h
    4848 */
    49 function getDisconnectReason(id)
     49function getDisconnectReason(id, wasConnected)
    5050{
    5151    switch (id)
    5252    {
    53     case 0: return translateWithContext("network disconnect", "Unknown reason");
     53    case 0: return wasConnected ? translateWithContext("network disconnect", "Unknown reason") : translate("Unable to join game. This is often caused by UDP port 20595 not being forwarded on the host side or by a firewall or an anti-virus software.");
    5454    case 1: return translate("The host has ended the game");
    5555    case 2: return translate("Incorrect network protocol version");
    5656    case 3: return translate("Game is loading, please try later");
     
    7070 *
    7171 * @param {number} reason
    7272 */
    73 function reportDisconnect(reason)
     73function reportDisconnect(reason, wasConnected)
    7474{
    7575    // Translation: States the reason why the client disconnected from the server.
    76     let reasonText = sprintf(translate("Reason: %(reason)s."), { "reason": getDisconnectReason(reason) });
    77     messageBox(400, 200, translate("Lost connection to the server.") + "\n\n" + reasonText, translate("Disconnected"), 2);
     76    let reasonText = sprintf(translate("Reason: %(reason)s."), { "reason": getDisconnectReason(reason, wasConnected) })
     77    messageBox(400, 200, (wasConnected ? translate("Lost connection to the server.") : translate("Failed to connect to server")) + "\n\n" + reasonText, translate("Disconnected"), 2);
    7878}
    7979
    8080function kickPlayer(username, ban)
  • binaries/data/mods/public/gui/gamesetup/gamesetup.js

     
    623623    }
    624624
    625625    cancelSetup();
    626     reportDisconnect(message.reason);
     626    reportDisconnect(message.reason, true);
    627627}
    628628
    629629/**
  • binaries/data/mods/public/gui/gamesetup/gamesetup_mp.js

     
    9292                {
    9393                case "disconnected":
    9494                    cancelSetup();
    95                     reportDisconnect(message.reason);
     95                    reportDisconnect(message.reason, false);
    9696                    return;
    9797
    9898                default:
     
    165165
    166166                case "disconnected":
    167167                    cancelSetup();
    168                     reportDisconnect(message.reason);
     168                    reportDisconnect(message.reason, false);
    169169                    return;
    170170
    171171                default:
  • binaries/data/mods/public/gui/session/messages.js

     
    5959var g_StatusMessageTypes = {
    6060    "authenticated": msg => translate("Connection to the server has been authenticated."),
    6161    "connected": msg => translate("Connected to the server."),
     62    // Translation: States the reason why the client disconnected from the server.
    6263    "disconnected": msg => translate("Connection to the server has been lost.") + "\n" +
    63                     // Translation: States the reason why the client disconnected from the server.
    64                     sprintf(translate("Reason: %(reason)s."), { "reason": getDisconnectReason(msg.reason) }),
     64        sprintf(translate("Reason: %(reason)s."), { "reason": getDisconnectReason(msg.reason, true) }),
    6565    "waiting_for_players": msg => translate("Waiting for other players to connect..."),
    6666    "join_syncing": msg => translate("Synchronising gameplay with other players..."),
    6767    "active": msg => ""