diff options
Diffstat (limited to 'backend/loader.py')
| -rw-r--r-- | backend/loader.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/backend/loader.py b/backend/loader.py index 8c4c4a7f..d8b97bbd 100644 --- a/backend/loader.py +++ b/backend/loader.py @@ -101,9 +101,13 @@ class Loader: return web.FileResponse(file, headers={"Cache-Control": "no-cache"}) async def handle_frontend_locales(self, request): - file = path.join(path.dirname(__file__), "locales", request.match_info["path"]) - - return web.FileResponse(file, headers={"Cache-Control": "no-cache", "Content-Type": "application/json"}) + req_lang = request.match_info["path"] + file = path.join(path.dirname(__file__), "locales", req_lang) + if exists(file): + return web.FileResponse(file, headers={"Cache-Control": "no-cache", "Content-Type": "application/json"}) + else: + self.logger.info(f"Language {req_lang} not available, returning an empty dictionary") + return web.json_response(data={}, headers={"Cache-Control": "no-cache"}) async def get_plugins(self, request): plugins = list(self.plugins.values()) |
