0ad/binaries/data/mods/public/gui/common/network.js
Gallaecio e05c8263c5 Internationalization of the public mod (JavaScript and GUI XML side)
It includes a marvelous language selection menu developed by Yves.

It also includes the introduction of a sprintf implementation for
JavaScript, as well as
translation helper functions that use JavaScript-side translation
caching.

This patch includes code by Yves, sanderd17, leper and Gallaecio.

Ref #67

This was SVN commit r14954.
2014-04-20 20:51:48 +00:00

22 lines
667 B
JavaScript

function getDisconnectReason(id)
{
// Must be kept in sync with source/network/NetHost.h
switch (id)
{
case 0: return translate("Unknown reason");
case 1: return translate("Unexpected shutdown");
case 2: return translate("Incorrect network protocol version");
case 3: return translate("Game has already started");
default: return sprintf(translate("[Invalid value %(id)s]"), { id: id });
}
}
function reportDisconnect(reason)
{
var reasontext = getDisconnectReason(reason);
messageBox(400, 200,
translate("Lost connection to the server.") + "\n\n" + sprintf(translate("Reason: %(reason)s."), { reason: reasontext }),
translate("Disconnected"), 2);
}