diff --git a/compose/rest.yaml b/compose/rest.yaml index 3e6a80bf4..d6e22b504 100644 --- a/compose/rest.yaml +++ b/compose/rest.yaml @@ -170,7 +170,7 @@ endpoints: required: true title: ID post: - - name: translation + - name: translations type: locale.ResourceTranslationSet title: Resource translation to upsert required: true @@ -407,7 +407,7 @@ endpoints: required: true title: ID post: - - name: translation + - name: translations type: locale.ResourceTranslationSet title: Resource translation to upsert required: true @@ -578,7 +578,7 @@ endpoints: required: true title: ID post: - - name: translation + - name: translations type: locale.ResourceTranslationSet title: Resource translation to upsert required: true diff --git a/compose/rest/module.go b/compose/rest/module.go index 9c31fcac3..d069a3263 100644 --- a/compose/rest/module.go +++ b/compose/rest/module.go @@ -99,7 +99,7 @@ func (ctrl *Module) ListTranslations(ctx context.Context, r *request.ModuleListT } func (ctrl *Module) UpdateTranslations(ctx context.Context, r *request.ModuleUpdateTranslations) (interface{}, error) { - return api.OK(), ctrl.locale.Upsert(ctx, r.Translation) + return api.OK(), ctrl.locale.Upsert(ctx, r.Translations) } func (ctrl *Module) Create(ctx context.Context, r *request.ModuleCreate) (interface{}, error) { diff --git a/compose/rest/namespace.go b/compose/rest/namespace.go index 82d9b6e99..4a6a83256 100644 --- a/compose/rest/namespace.go +++ b/compose/rest/namespace.go @@ -110,7 +110,7 @@ func (ctrl Namespace) ListTranslations(ctx context.Context, r *request.Namespace } func (ctrl Namespace) UpdateTranslations(ctx context.Context, r *request.NamespaceUpdateTranslations) (interface{}, error) { - return api.OK(), ctrl.locale.Upsert(ctx, r.Translation) + return api.OK(), ctrl.locale.Upsert(ctx, r.Translations) } func (ctrl Namespace) Update(ctx context.Context, r *request.NamespaceUpdate) (interface{}, error) { diff --git a/compose/rest/page.go b/compose/rest/page.go index 1a17491a3..66d13af53 100644 --- a/compose/rest/page.go +++ b/compose/rest/page.go @@ -134,7 +134,7 @@ func (ctrl *Page) ListTranslations(ctx context.Context, r *request.PageListTrans } func (ctrl *Page) UpdateTranslations(ctx context.Context, r *request.PageUpdateTranslations) (interface{}, error) { - return api.OK(), ctrl.locale.Upsert(ctx, r.Translation) + return api.OK(), ctrl.locale.Upsert(ctx, r.Translations) } func (ctrl *Page) Reorder(ctx context.Context, r *request.PageReorder) (interface{}, error) { diff --git a/compose/rest/request/module.go b/compose/rest/request/module.go index 8569228e8..c3113d1ef 100644 --- a/compose/rest/request/module.go +++ b/compose/rest/request/module.go @@ -218,10 +218,10 @@ type ( // ID ModuleID uint64 `json:",string"` - // Translation POST parameter + // Translations POST parameter // // Resource translation to upsert - Translation locale.ResourceTranslationSet + Translations locale.ResourceTranslationSet } ) @@ -856,9 +856,9 @@ func NewModuleUpdateTranslations() *ModuleUpdateTranslations { // Auditable returns all auditable/loggable parameters func (r ModuleUpdateTranslations) Auditable() map[string]interface{} { return map[string]interface{}{ - "namespaceID": r.NamespaceID, - "moduleID": r.ModuleID, - "translation": r.Translation, + "namespaceID": r.NamespaceID, + "moduleID": r.ModuleID, + "translations": r.Translations, } } @@ -873,8 +873,8 @@ func (r ModuleUpdateTranslations) GetModuleID() uint64 { } // Auditable returns all auditable/loggable parameters -func (r ModuleUpdateTranslations) GetTranslation() locale.ResourceTranslationSet { - return r.Translation +func (r ModuleUpdateTranslations) GetTranslations() locale.ResourceTranslationSet { + return r.Translations } // Fill processes request and fills internal variables @@ -898,8 +898,8 @@ func (r *ModuleUpdateTranslations) Fill(req *http.Request) (err error) { // POST params - //if val, ok := req.Form["translation[]"]; ok && len(val) > 0 { - // r.Translation, err = locale.ResourceTranslationSet(val), nil + //if val, ok := req.Form["translations[]"]; ok && len(val) > 0 { + // r.Translations, err = locale.ResourceTranslationSet(val), nil // if err != nil { // return err // } diff --git a/compose/rest/request/namespace.go b/compose/rest/request/namespace.go index d33a0479b..9954c0d9b 100644 --- a/compose/rest/request/namespace.go +++ b/compose/rest/request/namespace.go @@ -179,10 +179,10 @@ type ( // ID NamespaceID uint64 `json:",string"` - // Translation POST parameter + // Translations POST parameter // // Resource translation to upsert - Translation locale.ResourceTranslationSet + Translations locale.ResourceTranslationSet } ) @@ -756,8 +756,8 @@ func NewNamespaceUpdateTranslations() *NamespaceUpdateTranslations { // Auditable returns all auditable/loggable parameters func (r NamespaceUpdateTranslations) Auditable() map[string]interface{} { return map[string]interface{}{ - "namespaceID": r.NamespaceID, - "translation": r.Translation, + "namespaceID": r.NamespaceID, + "translations": r.Translations, } } @@ -767,8 +767,8 @@ func (r NamespaceUpdateTranslations) GetNamespaceID() uint64 { } // Auditable returns all auditable/loggable parameters -func (r NamespaceUpdateTranslations) GetTranslation() locale.ResourceTranslationSet { - return r.Translation +func (r NamespaceUpdateTranslations) GetTranslations() locale.ResourceTranslationSet { + return r.Translations } // Fill processes request and fills internal variables @@ -792,8 +792,8 @@ func (r *NamespaceUpdateTranslations) Fill(req *http.Request) (err error) { // POST params - //if val, ok := req.Form["translation[]"]; ok && len(val) > 0 { - // r.Translation, err = locale.ResourceTranslationSet(val), nil + //if val, ok := req.Form["translations[]"]; ok && len(val) > 0 { + // r.Translations, err = locale.ResourceTranslationSet(val), nil // if err != nil { // return err // } diff --git a/compose/rest/request/page.go b/compose/rest/request/page.go index 37b1a9877..f1cf66d1f 100644 --- a/compose/rest/request/page.go +++ b/compose/rest/request/page.go @@ -297,10 +297,10 @@ type ( // ID PageID uint64 `json:",string"` - // Translation POST parameter + // Translations POST parameter // // Resource translation to upsert - Translation locale.ResourceTranslationSet + Translations locale.ResourceTranslationSet } ) @@ -1229,9 +1229,9 @@ func NewPageUpdateTranslations() *PageUpdateTranslations { // Auditable returns all auditable/loggable parameters func (r PageUpdateTranslations) Auditable() map[string]interface{} { return map[string]interface{}{ - "namespaceID": r.NamespaceID, - "pageID": r.PageID, - "translation": r.Translation, + "namespaceID": r.NamespaceID, + "pageID": r.PageID, + "translations": r.Translations, } } @@ -1246,8 +1246,8 @@ func (r PageUpdateTranslations) GetPageID() uint64 { } // Auditable returns all auditable/loggable parameters -func (r PageUpdateTranslations) GetTranslation() locale.ResourceTranslationSet { - return r.Translation +func (r PageUpdateTranslations) GetTranslations() locale.ResourceTranslationSet { + return r.Translations } // Fill processes request and fills internal variables @@ -1271,8 +1271,8 @@ func (r *PageUpdateTranslations) Fill(req *http.Request) (err error) { // POST params - //if val, ok := req.Form["translation[]"]; ok && len(val) > 0 { - // r.Translation, err = locale.ResourceTranslationSet(val), nil + //if val, ok := req.Form["translations[]"]; ok && len(val) > 0 { + // r.Translations, err = locale.ResourceTranslationSet(val), nil // if err != nil { // return err // } diff --git a/compose/service/locale.go b/compose/service/locale.go index aa730f8dc..b2c7f67a6 100644 --- a/compose/service/locale.go +++ b/compose/service/locale.go @@ -21,10 +21,10 @@ func (svc resourceTranslation) moduleExtended(ctx context.Context, res *types.Mo for _, f := range res.Fields { k = types.LocaleKeyModuleFieldLabel out = append(out, &locale.ResourceTranslation{ - Resource: res.ResourceTranslation(), + Resource: f.ResourceTranslation(), Lang: tag.String(), Key: k.Path, - Msg: svc.locale.TRFor(tag, res.ResourceTranslation(), k.Path), + Msg: svc.locale.TRFor(tag, f.ResourceTranslation(), k.Path), }) // Extra field bits