Fix module field resource translations
This commit is contained in:
+3
-3
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
// }
|
||||
|
||||
@@ -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
|
||||
// }
|
||||
|
||||
@@ -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
|
||||
// }
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user