diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-03-04 14:43:23 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2023-03-04 17:19:14 +0100 |
commit | 6c798eba607a7e019cc1dfce6fd68be7f770c5bd (patch) | |
tree | deb10a398953f85ecc509585934fe4e0e8445e55 /tpl | |
parent | ec1c97e7e9d62ce5245135e0906fdedf14af0cae (diff) |
Page context handling in i18n
This is a workaround. We need to improve on this, but not today.
Fixes #10782
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/lang/lang.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tpl/lang/lang.go b/tpl/lang/lang.go index 17d37faa4..d2de243d6 100644 --- a/tpl/lang/lang.go +++ b/tpl/lang/lang.go @@ -15,6 +15,7 @@ package lang import ( + "context" "fmt" "math" "strconv" @@ -45,7 +46,7 @@ type Namespace struct { } // Translate returns a translated string for id. -func (ns *Namespace) Translate(id any, args ...any) (string, error) { +func (ns *Namespace) Translate(ctx context.Context, id any, args ...any) (string, error) { var templateData any if len(args) > 0 { @@ -60,7 +61,7 @@ func (ns *Namespace) Translate(id any, args ...any) (string, error) { return "", nil } - return ns.deps.Translate(sid, templateData), nil + return ns.deps.Translate(ctx, sid, templateData), nil } // FormatNumber formats number with the given precision for the current language. |