feat(07-07): localize lagoon validation with Laravel-shaped Polish messages

Replay of the user-api corpus needs lagoon::validate.* catalogs and
underscore-to-space attribute names so Go 422 bodies match Winter.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jakub Zych
2026-09-22 23:56:58 +02:00
parent dd3cb7ac29
commit 31634f706f
5 changed files with 124 additions and 31 deletions

6
phrasebook/lang.go Normal file
View File

@@ -0,0 +1,6 @@
package phrasebook
import "embed"
//go:embed lang
var systemLangFS embed.FS

View File

@@ -0,0 +1,13 @@
required: "The :attribute field is required."
email: "The :attribute must be a valid email address."
between: "The :attribute must be between :min and :max characters."
boolean: "The :attribute field must be true or false."
unique: "The :attribute has already been taken."
confirmed: "The :attribute confirmation does not match."
different: "The :attribute and :other must be different."
integer: "The :attribute must be an integer."
numeric: "The :attribute must be a number."
max: "The :attribute may not be greater than :max."
min: "The :attribute must be at least :min."
oneof: "The selected :attribute is invalid."
mimes: "The :attribute must be a file of the allowed types."

View File

@@ -0,0 +1,13 @@
required: "Pole :attribute jest wymagane."
email: "Format :attribute jest nieprawidłowy."
between: ":attribute musi zawierać się w granicach :min - :max znaków."
boolean: ":attribute musi mieć wartość prawda albo fałsz"
unique: "Taki :attribute już występuje."
confirmed: "Potwierdzenie :attribute nie zgadza się."
different: ":attribute oraz :other muszą się różnić."
integer: ":attribute musi być liczbą całkowitą."
numeric: ":attribute musi być liczbą."
max: ":attribute nie może być dłuższy niż :max znaków."
min: ":attribute musi mieć przynajmniej :min znaków."
oneof: "Zaznaczony :attribute jest nieprawidłowy."
mimes: ":attribute musi być plikiem typu :values."

View File

@@ -88,6 +88,9 @@ func Activate[P interface{ ID() string }](app *backpack.App, plugins []P) error
return fmt.Errorf("phrasebook: app is nil")
}
cat := NewCatalog()
if err := cat.Load("lagoon", systemLangFS); err != nil {
return err
}
for _, p := range plugins {
hl, ok := any(p).(pact.HasLang)
if !ok {