3
0

Fix module field resource translations

This commit is contained in:
Denis Arh
2021-09-14 21:25:35 +02:00
committed by Tomaž Jerman
parent cfd95a6682
commit 9a2e58532c
8 changed files with 34 additions and 34 deletions
+3 -3
View File
@@ -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
+1 -1
View File
@@ -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) {
+1 -1
View File
@@ -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) {
+1 -1
View File
@@ -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) {
+9 -9
View File
@@ -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
// }
+8 -8
View File
@@ -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
// }
+9 -9
View File
@@ -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
// }
+2 -2
View File
@@ -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