Skip to content

Commit e66084a

Browse files
committed
fix: add missing log warning for non-existent translations and update go.mod
1 parent d3587a7 commit e66084a

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

go.mod

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ require (
66
github.com/BurntSushi/toml v1.3.2
77
github.com/nicksnyder/go-i18n/v2 v2.4.0
88
github.com/sirupsen/logrus v1.9.3
9+
github.com/stretchr/testify v1.7.0
910
golang.org/x/text v0.14.0
1011
)
1112

12-
require golang.org/x/sys v0.5.0 // indirect
13+
require (
14+
github.com/davecgh/go-spew v1.1.1 // indirect
15+
github.com/pmezard/go-difflib v1.0.0 // indirect
16+
golang.org/x/sys v0.5.0 // indirect
17+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
18+
)

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
1717
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1818
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
1919
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
20+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
2021
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
2122
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
2223
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=

pkg/i18n/i18n.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,13 @@ func (t *Translator) Translate(messageID string, templateData map[string]interfa
105105
})
106106

107107
if err != nil {
108-
// If error, return the original ID without logging
109-
// This prevents recursive logging calls
108+
// Log a warning about the missing translation
109+
t.log.Warn("errors.translation_not_found", map[string]interface{}{
110+
"messageID": messageID,
111+
"error": err.Error(),
112+
})
113+
114+
// If error, return the original ID
110115
return messageID
111116
}
112117

0 commit comments

Comments
 (0)