From ac5495134b735835b9d64839d5f9e9647c7f43f3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 14 Mar 2026 08:59:57 +0000 Subject: [PATCH 1/4] Initial plan From 0592c59174bfb2cbb2b96f62297963c9a6c1bb60 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 14 Mar 2026 09:07:17 +0000 Subject: [PATCH 2/4] fix(ui): add missing suggested_languages global to error templates The error templates (404.html, 500.html) extend base.html which uses {{ suggested_languages | tojson }} in the language selector dropdown. The _error_templates instance in app/main.py was missing this global, causing Jinja2 Undefined objects to be passed to the tojson filter, resulting in "TypeError: Object of type Undefined is not JSON serializable" errors in 35 tests. Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com> --- app/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app/main.py b/app/main.py index 6089699b..72b0155c 100644 --- a/app/main.py +++ b/app/main.py @@ -267,6 +267,7 @@ _error_templates.env.globals["_"] = lambda key, **kwargs: _translate_fn(key, "en _error_templates.env.globals["min"] = min _error_templates.env.globals["max"] = max _error_templates.env.globals["supported_languages"] = _SUPPORTED_LANGUAGES +_error_templates.env.globals["suggested_languages"] = [] @app.exception_handler(HTTPException) From b148675ba8192d9bb42757f0284dcd63960909a4 Mon Sep 17 00:00:00 2001 From: Christian Krakau-Louis Date: Sat, 14 Mar 2026 10:44:14 +0100 Subject: [PATCH 3/4] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- app/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index 72b0155c..d55b3a87 100644 --- a/app/main.py +++ b/app/main.py @@ -262,12 +262,13 @@ _error_templates = Jinja2Templates(directory=str(_error_templates_dir)) # Error pages use the default language (English); request-specific locale is not needed here. from app.utils.i18n import SUPPORTED_LANGUAGES as _SUPPORTED_LANGUAGES # noqa: E402 from app.utils.i18n import translate as _translate_fn # noqa: E402 +from app.utils.i18n import get_suggested_languages as _get_suggested_languages # noqa: E402 _error_templates.env.globals["_"] = lambda key, **kwargs: _translate_fn(key, "en", **kwargs) _error_templates.env.globals["min"] = min _error_templates.env.globals["max"] = max _error_templates.env.globals["supported_languages"] = _SUPPORTED_LANGUAGES -_error_templates.env.globals["suggested_languages"] = [] +_error_templates.env.globals["suggested_languages"] = _get_suggested_languages("en", "") @app.exception_handler(HTTPException) From de0b674025943dcc6aa21edc9e8027512964a605 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 14 Mar 2026 09:45:05 +0000 Subject: [PATCH 4/4] style: apply ruff auto-fix - Auto-formatted code with ruff format - Applied ruff linting fixes with --fix Co-authored-by: github-actions[bot] --- app/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index d55b3a87..82c4fd59 100644 --- a/app/main.py +++ b/app/main.py @@ -261,8 +261,8 @@ _error_templates = Jinja2Templates(directory=str(_error_templates_dir)) # Register the i18n translate helper as a global so error templates can use {{ _("key") }}. # Error pages use the default language (English); request-specific locale is not needed here. from app.utils.i18n import SUPPORTED_LANGUAGES as _SUPPORTED_LANGUAGES # noqa: E402 -from app.utils.i18n import translate as _translate_fn # noqa: E402 from app.utils.i18n import get_suggested_languages as _get_suggested_languages # noqa: E402 +from app.utils.i18n import translate as _translate_fn # noqa: E402 _error_templates.env.globals["_"] = lambda key, **kwargs: _translate_fn(key, "en", **kwargs) _error_templates.env.globals["min"] = min