feat(api): localize console pages and api error messages

The language comes from the user setting, then the lang cookie, then
Accept-Language, falling back to English. Errors keep a stable code and
carry a translated message.

Closes #42

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-22 00:07:00 +01:00
1 parent dde7b890b8
commit 70190446ff
12 files changed
+698 -211

No files matched your search

+7 -6
View File
@@ -8,8 +8,8 @@ import (
"time"
"git.zb-server.de/ZB-Server/uptimesebi/internal/api"
"git.zb-server.de/ZB-Server/uptimesebi/internal/auth"
"git.zb-server.de/ZB-Server/uptimesebi/internal/config"
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
"git.zb-server.de/ZB-Server/uptimesebi/internal/migrations"
"git.zb-server.de/ZB-Server/uptimesebi/internal/platform"
"git.zb-server.de/ZB-Server/uptimesebi/internal/sealed"
@@ -54,15 +54,16 @@ func run(log *slog.Logger, args []string) error {
}
defer deps.Close()
srv := api.New(cfg, log, tenant.New(deps.DB), deps.Redis, keys)
catalog, err := i18n.Load()
if err != nil {
return err
}
srv := api.New(cfg, api.Deps{Log: log, DB: tenant.New(deps.DB), Redis: deps.Redis, Keys: keys, Catalog: catalog})
health := platform.NewHealth(deps.Probes())
r := platform.NewRouter(log)
health.Register(r)
r.StaticFS("/static", web.Static())
app := r.Group("/", srv.Sessions().Load(), auth.CSRF())
srv.Register(app)
srv.RegisterPages(app)
srv.Mount(r)
return platform.Serve(ctx, log, platform.NewHTTPServer(cfg.Listen, r), health, 5*time.Second, cfg.ShutdownTimeout)
}