Skip to content

Commit

Permalink
WIP: hector fb
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianthetreep committed Jan 14, 2025
1 parent 02304f0 commit 474cb1c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions translator/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ type TranslationService struct {
bundle *i18n.Bundle
}

func New(bundlesFS embed.FS, bundle *i18n.Bundle) TranslationService {
func New(bundlesFS embed.FS, bundle *i18n.Bundle) (*TranslationService, error) {
bundle.RegisterUnmarshalFunc("yaml", yaml.Unmarshal)

_, err := bundle.LoadMessageFileFS(bundlesFS, "active.en.yaml")
if err != nil {
panic(err)
return nil, err
}

_, err = bundle.LoadMessageFileFS(bundlesFS, "active.fr.yaml")
if err != nil {
panic(err)
return nil, err
}

return TranslationService{
return &TranslationService{
bundlesFS: bundlesFS,
bundle: bundle,
}
}, nil
}

func (svc TranslationService) Translate(
Expand Down

0 comments on commit 474cb1c

Please sign in to comment.