Adds translations to start error messages.

This commit is contained in:
Andrew 2021-09-13 15:37:59 -04:00
parent 65295604a3
commit 45d2bff57a
4 changed files with 16 additions and 6 deletions

View File

@ -20,6 +20,7 @@ from app.classes.shared.helpers import helper
from app.classes.shared.console import console
from app.classes.shared.models import db_helper, Servers
from app.classes.web.websocket_helper import websocket_helper
from app.classes.shared.translation import translation
logger = logging.getLogger(__name__)
@ -188,7 +189,7 @@ class Server:
msg = "Server {} failed to start with error code: {}".format(self.name, ex)
logger.error(msg)
websocket_helper.broadcast('send_start_error', {
'error': msg
'error': translation.translate('error', 'start-error').format(self.name, ex)
})
return False
if helper.check_internet():
@ -198,11 +199,11 @@ class Server:
})
else:
websocket_helper.broadcast('send_start_error', {
'error': "We have detected port {} may not be open on the host network or a firewall is blocking it. Remote client connections to the server may be limited.".format(loc_server_port)
'error': translation.translate('error', 'closedPort').format(loc_server_port)
})
else:
websocket_helper.broadcast('send_start_error', {
'error': "We have detected the machine running Crafty has no connection to the internet. Client connections to the server may be limited."
'error': translation.translate('error', 'internet')
})

View File

@ -10,7 +10,10 @@
"contact": "Contact Crafty Control Support via Discord",
"terribleFailure": "What a Terrible Failure!",
"embarassing": "Oh my, well, this is embarrassing.",
"error": "Error!"
"error": "Error!",
"start-error": "Server {} failed to start with error code: {}",
"closedPort": "We have detected port {} may not be open on the host network or a firewall is blocking it. Remote client connections to the server may be limited.",
"internet": "We have detected the machine running Crafty has no connection to the internet. Client connections to the server may be limited."
},
"404": {
"contact": "Contact Crafty Control Support via Discord",

View File

@ -10,7 +10,10 @@
"contact": "Ota yhteyttä Crafty Control -tukeen Discordin kautta",
"terribleFailure": "Mikä kauhea epäonnistuminen!",
"embarassing": "No, tämähän on noloa.",
"error": "Virhe!"
"error": "Virhe!",
"start-error": "Server {} failed to start with error code: {}",
"closedPort": "We have detected port {} may not be open on the host network or a firewall is blocking it. Remote client connections to the server may be limited.",
"internet": "We have detected the machine running Crafty has no connection to the internet. Client connections to the server may be limited."
},
"404": {
"contact": "Ota yhteyttä Crafty Control -tukeen Discordin kautta",

View File

@ -10,7 +10,10 @@
"contact": "Contacter le Support de Crafty Control via Discord",
"terribleFailure": "C'est une Terrible Erreur !",
"embarassing": "Oulà, c'est embarrassant.",
"error": "Erreur !"
"error": "Erreur !",
"start-error": "Server {} failed to start with error code: {}",
"closedPort": "We have detected port {} may not be open on the host network or a firewall is blocking it. Remote client connections to the server may be limited.",
"internet": "We have detected the machine running Crafty has no connection to the internet. Client connections to the server may be limited."
},
"404": {
"contact": "Contacter le Support de Crafty Control via Discord",