test(09-03): add failing tests for form locale and dropdown options
- The same cached schema must localize pl and en independently, including Accept-Language parent fallback and raw keys - YAML option maps keep order and scalar type, and a method provider is required at boot
This commit is contained in:
@@ -10,7 +10,10 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"context"
|
||||
|
||||
"git.golem15.com/golem15/summercms/pact"
|
||||
"git.golem15.com/golem15/summercms/phrasebook"
|
||||
"github.com/goccy/go-yaml"
|
||||
"github.com/goccy/go-yaml/ast"
|
||||
)
|
||||
@@ -455,6 +458,24 @@ func normalizeYAMLError(err error) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Localize resolves display strings for one request. It does not yet.
|
||||
func (s *FormSchema) Localize(ctx context.Context, tr *phrasebook.Translator, provider pact.DropdownOptionsProvider) (*FormView, error) {
|
||||
if s == nil || ctx == nil {
|
||||
return nil, fmt.Errorf("cabana: form localization is not implemented")
|
||||
}
|
||||
_ = tr
|
||||
_ = provider
|
||||
return nil, fmt.Errorf("cabana: form localization is not implemented")
|
||||
}
|
||||
|
||||
// CanonicalJSON will emit one localized response. It does not yet.
|
||||
func (v *FormView) CanonicalJSON() ([]byte, error) {
|
||||
if v == nil {
|
||||
return nil, fmt.Errorf("cabana: form localization is not implemented")
|
||||
}
|
||||
return nil, fmt.Errorf("cabana: form localization is not implemented")
|
||||
}
|
||||
|
||||
func compileFormIfPresent(pluginID string, ctl pact.AdminController, fsys fs.FS) (*FormSchema, error) {
|
||||
dir := strings.Trim(path.Clean(ctl.ConfigDir()), "/")
|
||||
if dir == "." || strings.HasPrefix(dir, "..") {
|
||||
|
||||
Reference in New Issue
Block a user