Add translations

This commit is contained in:
amcmanu3 2023-11-30 00:55:26 -05:00
parent 999460f95e
commit 90ed32738f
2 changed files with 16 additions and 3 deletions

View File

@ -13,6 +13,7 @@ from app.classes.shared.server import ServerInstance
from app.classes.shared.console import Console from app.classes.shared.console import Console
from app.classes.shared.helpers import Helpers from app.classes.shared.helpers import Helpers
from app.classes.shared.main_models import DatabaseShortcuts from app.classes.shared.main_models import DatabaseShortcuts
from app.classes.shared.translation import Translation
from app.classes.minecraft.stats import Stats from app.classes.minecraft.stats import Stats
@ -39,6 +40,7 @@ class ServersController(metaclass=Singleton):
self.stats = Stats(self.helper, self) self.stats = Stats(self.helper, self)
self.ws = WebSocketManager() self.ws = WebSocketManager()
self.server_subpage = {} self.server_subpage = {}
self.translation = Translation(self.helper)
# ********************************************************************************** # **********************************************************************************
# Generic Servers Methods # Generic Servers Methods
@ -172,10 +174,13 @@ class ServersController(metaclass=Singleton):
def init_all_servers(self): def init_all_servers(self):
servers = self.get_all_defined_servers() servers = self.get_all_defined_servers()
self.failed_servers = [] self.failed_servers = []
init_trans = self.translation.translate(
"startup", "server", self.helper.get_setting("language")
)
for server in servers: for server in servers:
self.ws.broadcast_to_admins( self.ws.broadcast_to_admins(
"update", {"message": f"Initializing {server['server_name']}."} "update",
{"message": f"{init_trans}{server['server_name']}."},
) )
server_id = server.get("server_id") server_id = server.get("server_id")

View File

@ -590,6 +590,14 @@
"newServer": "Create New Server", "newServer": "Create New Server",
"servers": "Servers" "servers": "Servers"
}, },
"startup": {
"serverInit": "Initializing Servers",
"server": "Initializing ",
"internet": "Checking for internet connection",
"tasks": "Starting Tasks Scheduler",
"internals": "Configuring and starting Crafty's internal componenets",
"almost": "Finishing up. Hang on tight..."
},
"userConfig": { "userConfig": {
"apiKey": "API Keys", "apiKey": "API Keys",
"auth": "Authorized? ", "auth": "Authorized? ",