summaryrefslogtreecommitdiff
path: root/backend/loader.py
diff options
context:
space:
mode:
authorMarco Rodolfi <marco.rodolfi@tuta.io>2023-05-04 17:46:00 +0200
committerGitHub <noreply@github.com>2023-05-04 16:46:00 +0100
commit089e6b086c7b125ef077a9351f50c292c8cbd712 (patch)
tree8d211e9911a1f612702570b662f5601a74ea3c4a /backend/loader.py
parent08d5c942a46df926e18b807a11761e447465def9 (diff)
downloaddecky-loader-089e6b086c7b125ef077a9351f50c292c8cbd712.tar.gz
decky-loader-089e6b086c7b125ef077a9351f50c292c8cbd712.zip
Small fix: handle missing localization in backend plus a small typo in the english language (#443)v2.8.0-pre3
* Hotfix for i18n where the detector was overriding localStorage * Please, pnpm, cooperate * Small fix regarding the backend getting hammered when switching to not supported languages plus a small english typo
Diffstat (limited to 'backend/loader.py')
-rw-r--r--backend/loader.py10
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())