fix(translations): stay on page
release.yaml / publish (push) Successful in 4m0s

This commit is contained in:
schreifuchs committed 2026-09-28 09:52:22 +02:00
1 parent c08dd355c0
commit 297efaa4a6
3 files changed
+45 -24

No files matched your search

+8
View File
@@ -53,13 +53,21 @@ func Path(ctx context.Context, pp ...string) string {
}
func PathForLang(ctx context.Context, lang string, pp ...string) string {
slog.Debug("computing path for lang", "pp", pp, "lang", lang)
s, ok := ctx.Value(serviceKey).(*Service)
if !ok {
slog.Error("could not extract translation service from context for translating path", "ctx", ctx, "path", pp)
return path.Join(pp...)
}
// remove leading ""
for len(pp) > 0 && pp[0] == "" {
pp = pp[1:]
}
if len(pp) > 0 {
slog.Debug("computing path for lang", "pp", pp, "lang", lang, "pp[0]", pp[0], "translations", s.translations)
if _, ok := s.translations[pp[0]]; ok {
pp = pp[1:]
}