Skip to content

Commit 5492bd4

Browse files
fixed a gosec issue
1 parent 2b6806c commit 5492bd4

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

plugin/i18n/i18n.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,16 @@ func InitWithLocale(locale string) *goi18n.Localizer {
9797

9898
bundle := goi18n.NewBundle(language.English)
9999
bundle.RegisterUnmarshalFunc("json", json.Unmarshal)
100-
bundle.LoadMessageFileFS(LocaleFS, "v2Resources/active.en-US.json")
100+
err := bundle.LoadMessageFileFS(LocaleFS, "v2Resources/active.en-US.json")
101+
if err != nil {
102+
fmt.Printf("Unable to load language from v2Resources/active.en-US.json\n", lang_file)
103+
}
101104
if locale != "en_US" {
102-
bundle.LoadMessageFileFS(LocaleFS, fmt.Sprintf("v2Resources/active.%s.json", locale))
105+
lang_file := fmt.Sprintf("v2Resources/active.%s.json", locale)
106+
err = bundle.LoadMessageFileFS(LocaleFS, lang_file)
107+
if err != nil {
108+
fmt.Printf("Unable to load language from %s\n", lang_file)
109+
}
103110
}
104111
loc := goi18n.NewLocalizer(bundle, locale)
105112
return loc

0 commit comments

Comments
 (0)