Fix chart translations
This commit is contained in:
@@ -104,10 +104,8 @@ func (svc chart) Find(ctx context.Context, filter types.ChartFilter) (set types.
|
||||
return err
|
||||
}
|
||||
|
||||
// i18n
|
||||
tag := locale.GetAcceptLanguageFromContext(ctx)
|
||||
set.Walk(func(p *types.Chart) error {
|
||||
p.DecodeTranslations(svc.locale.Locale().ResourceTranslations(tag, p.ResourceTranslation()))
|
||||
set.Walk(func(c *types.Chart) error {
|
||||
svc.proc(ctx, c)
|
||||
return nil
|
||||
})
|
||||
|
||||
@@ -139,6 +137,15 @@ func (svc chart) FindByHandle(ctx context.Context, namespaceID uint64, h string)
|
||||
})
|
||||
}
|
||||
|
||||
func (svc chart) proc(ctx context.Context, c *types.Chart) {
|
||||
if svc.locale == nil || svc.locale.Locale() == nil {
|
||||
return
|
||||
}
|
||||
|
||||
tag := locale.GetAcceptLanguageFromContext(ctx)
|
||||
c.DecodeTranslations(svc.locale.Locale().ResourceTranslations(tag, c.ResourceTranslation()))
|
||||
}
|
||||
|
||||
func (svc chart) Create(ctx context.Context, new *types.Chart) (*types.Chart, error) {
|
||||
var (
|
||||
err error
|
||||
@@ -226,6 +233,8 @@ func (svc chart) lookup(ctx context.Context, namespaceID uint64, lookup func(*ch
|
||||
return ChartErrNotAllowedToRead()
|
||||
}
|
||||
|
||||
svc.proc(ctx, c)
|
||||
|
||||
if err = label.Load(ctx, svc.store, c); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user