mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-08 22:13:26 +09:00
refactor: clean up form binding & validation (#38873)
Clarify the "validation" and "error display" logic. All the copied&pasted `Validate` functions are removed.
This commit is contained in:
@@ -19,6 +19,18 @@ type Locale interface {
|
||||
HasKey(trKey string) bool
|
||||
}
|
||||
|
||||
// LocaleTranslation represents an interface to translation
|
||||
type LocaleTranslation interface {
|
||||
Language() string
|
||||
HasKey(trKey string) bool
|
||||
TrString(string, ...any) string
|
||||
|
||||
Tr(key string, args ...any) template.HTML
|
||||
TrN(cnt any, key1, keyN string, args ...any) template.HTML
|
||||
|
||||
PrettyNumber(v any) string
|
||||
}
|
||||
|
||||
// LocaleStore provides the functions common to all locale stores
|
||||
type LocaleStore interface {
|
||||
io.Closer
|
||||
@@ -31,7 +43,7 @@ type LocaleStore interface {
|
||||
Locale(langName string) (Locale, bool)
|
||||
// HasLang returns whether a given language is present in the store
|
||||
HasLang(langName string) bool
|
||||
// AddLocaleByIni adds a new language to the store
|
||||
// AddLocaleByJSON adds a new language to the store
|
||||
AddLocaleByJSON(langName, langDesc string, source, moreSource []byte) error
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user