feat(09-03): localize form schemas and resolve dropdown options

- Cached schemas stay source-key IR and each response carries its own meta.locale
- YAML option maps keep declaration order and scalar type; method options call DropdownOptions and fail boot without a provider
This commit is contained in:
Jakub Zych
2026-09-24 18:21:59 +02:00
parent ad1b76085a
commit da8828ef38
2 changed files with 152 additions and 18 deletions

View File

@@ -116,6 +116,14 @@ func Activate[P interface{ ID() string }](app *backpack.App, plugins []P) error
return nil
}
// Locale returns the configured app locale. Request locales stay on the context.
func (t *Translator) Locale() string {
if t == nil || strings.TrimSpace(t.locale) == "" {
return defaultLocale
}
return t.locale
}
// Get returns the translation for key using the request locale when present,
// otherwise the configured app locale.
func (t *Translator) Get(ctx context.Context, key string, params map[string]string) string {