diff --git a/codegen/assets/templates/gocode/locale/$component_service.go.tpl b/codegen/assets/templates/gocode/locale/$component_service.go.tpl index 906830967..7076f331f 100644 --- a/codegen/assets/templates/gocode/locale/$component_service.go.tpl +++ b/codegen/assets/templates/gocode/locale/$component_service.go.tpl @@ -61,7 +61,7 @@ func (svc resourceTranslationsManager) Upsert(ctx context.Context, rr locale.Res // - managed resource translation strings are all for default language // or // - user is allowed to manage resource translations - return store.Tx(ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) { + err = store.Tx(ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) { if rr.ContainsForeign(svc.Locale().Default().Tag) { if !svc.ac.CanManageResourceTranslations(ctx) { return ErrNotAllowedToManageResourceTranslations @@ -132,12 +132,15 @@ func (svc resourceTranslationsManager) Upsert(ctx context.Context, rr locale.Res return err } - // Reload ALL resource translations - // @todo we could probably do this more selectively and refresh only updated resources? - _ = locale.Global().ReloadResourceTranslations(ctx) - return nil }) + if err != nil { + return err + } + + // Reload ALL resource translations + // @todo we could probably do this more selectively and refresh only updated resources? + return locale.Global().ReloadResourceTranslations(ctx) } func (svc resourceTranslationsManager) Locale() locale.Resource { diff --git a/compose/service/locale.gen.go b/compose/service/locale.gen.go index 0fc87e171..9ed4899d3 100644 --- a/compose/service/locale.gen.go +++ b/compose/service/locale.gen.go @@ -62,7 +62,7 @@ func (svc resourceTranslationsManager) Upsert(ctx context.Context, rr locale.Res // - managed resource translation strings are all for default language // or // - user is allowed to manage resource translations - return store.Tx(ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) { + err = store.Tx(ctx, svc.store, func(ctx context.Context, s store.Storer) (err error) { if rr.ContainsForeign(svc.Locale().Default().Tag) { if !svc.ac.CanManageResourceTranslations(ctx) { return ErrNotAllowedToManageResourceTranslations @@ -133,12 +133,15 @@ func (svc resourceTranslationsManager) Upsert(ctx context.Context, rr locale.Res return err } - // Reload ALL resource translations - // @todo we could probably do this more selectively and refresh only updated resources? - _ = locale.Global().ReloadResourceTranslations(ctx) - return nil }) + if err != nil { + return err + } + + // Reload ALL resource translations + // @todo we could probably do this more selectively and refresh only updated resources? + return locale.Global().ReloadResourceTranslations(ctx) } func (svc resourceTranslationsManager) Locale() locale.Resource {