From 07af12d57e30d17dd0f15bbda724db1d866fda1b Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 1 Mar 2022 17:28:33 -0800 Subject: i18n templates are a global, so capitalize --- fatcat_scholar/web.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'fatcat_scholar') diff --git a/fatcat_scholar/web.py b/fatcat_scholar/web.py index 29c15bc..83f80ad 100644 --- a/fatcat_scholar/web.py +++ b/fatcat_scholar/web.py @@ -242,7 +242,7 @@ def load_i18n_templates() -> Any: return d -i18n_templates = load_i18n_templates() +I18N_TEMPLATES = load_i18n_templates() @web.get("/", include_in_schema=False) @@ -253,7 +253,7 @@ async def web_home( ) -> Any: if content.mimetype == "application/json": return await home() - return i18n_templates[lang.code].TemplateResponse( + return I18N_TEMPLATES[lang.code].TemplateResponse( "home.html", {"request": request, "locale": lang.code, "lang_prefix": lang.prefix}, ) @@ -261,7 +261,7 @@ async def web_home( @web.get("/about", include_in_schema=False) async def web_about(request: Request, lang: LangPrefix = Depends(LangPrefix)) -> Any: - return i18n_templates[lang.code].TemplateResponse( + return I18N_TEMPLATES[lang.code].TemplateResponse( "about.html", {"request": request, "locale": lang.code, "lang_prefix": lang.prefix}, ) @@ -269,7 +269,7 @@ async def web_about(request: Request, lang: LangPrefix = Depends(LangPrefix)) -> @web.get("/help", include_in_schema=False) async def web_help(request: Request, lang: LangPrefix = Depends(LangPrefix)) -> Any: - return i18n_templates[lang.code].TemplateResponse( + return I18N_TEMPLATES[lang.code].TemplateResponse( "help.html", {"request": request, "locale": lang.code, "lang_prefix": lang.prefix}, ) @@ -311,7 +311,7 @@ def web_search( headers[ "Server-Timing" ] += f', es;desc="Search Internal Time";dur={hits.query_time_ms}' - return i18n_templates[lang.code].TemplateResponse( + return I18N_TEMPLATES[lang.code].TemplateResponse( "search.html", { "request": request, @@ -342,7 +342,7 @@ def web_work( if not doc: raise HTTPException(status_code=404, detail="work not found") - return i18n_templates[lang.code].TemplateResponse( + return I18N_TEMPLATES[lang.code].TemplateResponse( "work.html", { "request": request, @@ -427,7 +427,7 @@ def access_redirect_fallback( # give up and show an error page lang = LangPrefix(request) - return i18n_templates[lang.code].TemplateResponse( + return I18N_TEMPLATES[lang.code].TemplateResponse( "access_404.html", { "request": request, @@ -577,7 +577,7 @@ async def http_exception_handler(request: Request, exc: StarletteHTTPException) if content.mimetype == "text/html": lang = LangPrefix(request) - return i18n_templates[lang.code].TemplateResponse( + return I18N_TEMPLATES[lang.code].TemplateResponse( "error.html", { "request": request, -- cgit v1.2.3