diff --git a/app/classes/shared/server.py b/app/classes/shared/server.py index 36fe5852..66815f20 100644 --- a/app/classes/shared/server.py +++ b/app/classes/shared/server.py @@ -189,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': translation.translate('error', 'start-error').format(self.name, ex) + 'error': translation.translate('error', 'start-error', 'en_EN').format(self.name, ex) }) return False if helper.check_internet(): @@ -199,11 +199,11 @@ class Server: }) else: websocket_helper.broadcast('send_start_error', { - 'error': translation.translate('error', 'closedPort').format(loc_server_port) + 'error': translation.translate('error', 'closedPort', 'en_EN').format(loc_server_port) }) else: websocket_helper.broadcast('send_start_error', { - 'error': translation.translate('error', 'internet') + 'error': translation.translate('error', 'internet', 'en_EN') }) db_helper.set_waiting_start(self.server_id, False) diff --git a/app/classes/shared/translation.py b/app/classes/shared/translation.py index 8099ac09..8808e256 100644 --- a/app/classes/shared/translation.py +++ b/app/classes/shared/translation.py @@ -14,15 +14,13 @@ class Translation(): self.cached_translation = None self.cached_translation_lang = None self.lang_file_exists = [] - def translate(self, page, word): + def translate(self, page, word, lang): translated_word = None - lang = helper.get_setting('language') fallback_lang = 'en_EN' if lang not in self.lang_file_exists and \ helper.check_file_exists(os.path.join(self.translations_path, lang + '.json')): - self.lang_file_exists.append(lang) - + self.lang_file_exists.append(lang) translated_word = self.translate_inner(page, word, lang) \ if lang in self.lang_file_exists else self.translate_inner(page, word, fallback_lang) diff --git a/app/classes/web/panel_handler.py b/app/classes/web/panel_handler.py index b0be8686..f7e9eaac 100644 --- a/app/classes/web/panel_handler.py +++ b/app/classes/web/panel_handler.py @@ -69,6 +69,7 @@ class PanelHandler(BaseHandler): 'error': error, 'time': formatted_time } + page_data['lang'] = 'en_EN' page_data['super_user'] = exec_user['superuser'] if page == 'unauthorized': diff --git a/app/classes/web/public_handler.py b/app/classes/web/public_handler.py index 4388f909..9edf8853 100644 --- a/app/classes/web/public_handler.py +++ b/app/classes/web/public_handler.py @@ -43,6 +43,7 @@ class PublicHandler(BaseHandler): 'version': helper.get_version_string(), 'error': error } + page_data['lang'] = helper.get_setting('language') # sensible defaults template = "public/404.html" diff --git a/app/classes/web/tornado.py b/app/classes/web/tornado.py index aeed856f..bd13049d 100644 --- a/app/classes/web/tornado.py +++ b/app/classes/web/tornado.py @@ -92,17 +92,13 @@ class Webserver: http_port = helper.get_setting('http_port') https_port = helper.get_setting('https_port') - - lang = helper.get_setting('language') + debug_errors = helper.get_setting('show_errors') cookie_secret = helper.get_setting('cookie_secret') if cookie_secret is False: cookie_secret = helper.random_string_generator(32) - if not lang: - lang = "en_EN" - if not http_port: http_port = 8000 @@ -120,7 +116,7 @@ class Webserver: tornado.template.Loader('.') - tornado.locale.set_default_locale(lang) + tornado.locale.set_default_locale('en_EN') handler_args = {"controller": self.controller, "tasks_manager": self.tasks_manager, "translator": translation} handlers = [ diff --git a/app/frontend/templates/base.html b/app/frontend/templates/base.html index 9714b1e2..4a26038c 100644 --- a/app/frontend/templates/base.html +++ b/app/frontend/templates/base.html @@ -60,7 +60,7 @@