Skip to content

Commit

Permalink
Fix button translations on record-list block
Browse files Browse the repository at this point in the history
  • Loading branch information
darh committed Aug 21, 2022
1 parent ff40937 commit a2cea1c
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions compose/service/locale.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,13 @@ func (svc resourceTranslationsManager) pageExtended(ctx context.Context, res *ty
return nil, err
}

out = append(out, aux...)
case "RecordList":
aux, err = svc.pageExtendedRecordListBlock(tag, res, block, pbContentID)
if err != nil {
return nil, err
}

out = append(out, aux...)
case "Content":
k = types.LocaleKeyPagePageBlockBlockIDContentBody
Expand Down Expand Up @@ -326,15 +333,30 @@ func (svc resourceTranslationsManager) chartExtended(_ context.Context, res *typ

func (svc resourceTranslationsManager) pageExtendedAutomationBlock(tag language.Tag, res *types.Page, block types.PageBlock, blockID uint64) (locale.ResourceTranslationSet, error) {
var (
k = types.LocaleKeyPagePageBlockBlockIDButtonButtonIDLabel
out = make(locale.ResourceTranslationSet, 0, 10)
bb, _ = block.Options["buttons"].([]interface{})
)

return svc.pageBlockButtons(tag, res, blockID, bb)
}

func (svc resourceTranslationsManager) pageExtendedRecordListBlock(tag language.Tag, res *types.Page, block types.PageBlock, blockID uint64) (locale.ResourceTranslationSet, error) {
var (
bb, _ = block.Options["selectionButtons"].([]interface{})
)

return svc.pageBlockButtons(tag, res, blockID, bb)
}

func (svc resourceTranslationsManager) pageBlockButtons(tag language.Tag, res *types.Page, blockID uint64, bb []interface{}) (locale.ResourceTranslationSet, error) {
var (
k = types.LocaleKeyPagePageBlockBlockIDButtonButtonIDLabel
out = make(locale.ResourceTranslationSet, 0, 10)
)

for j, auxBtn := range bb {
btn := auxBtn.(map[string]interface{})

bContentID := uint64(0)
bContentID := uint64(1)
if aux, ok := btn["buttonID"]; ok {
bContentID = cast.ToUint64(aux)
}
Expand Down

0 comments on commit a2cea1c

Please sign in to comment.