mirror of
https://github.com/miniflux/v2.git
synced 2025-09-15 18:57:04 +00:00
Use unique translation IDs instead of English text as key
This commit is contained in:
parent
f244df6293
commit
beb7a0cfcb
66 changed files with 4069 additions and 2972 deletions
|
@ -19,7 +19,7 @@ type AuthForm struct {
|
|||
// Validate makes sure the form values are valid.
|
||||
func (a AuthForm) Validate() error {
|
||||
if a.Username == "" || a.Password == "" {
|
||||
return errors.NewLocalizedError("All fields are mandatory.")
|
||||
return errors.NewLocalizedError("error.fields_mandatory")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
@ -19,7 +19,7 @@ type CategoryForm struct {
|
|||
// Validate makes sure the form values are valid.
|
||||
func (c CategoryForm) Validate() error {
|
||||
if c.Title == "" {
|
||||
return errors.NewLocalizedError("The title is mandatory.")
|
||||
return errors.NewLocalizedError("error.title_required")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ type FeedForm struct {
|
|||
// ValidateModification validates FeedForm fields
|
||||
func (f FeedForm) ValidateModification() error {
|
||||
if f.FeedURL == "" || f.SiteURL == "" || f.Title == "" || f.CategoryID == 0 {
|
||||
return errors.NewLocalizedError("All fields are mandatory.")
|
||||
return errors.NewLocalizedError("error.fields_mandatory")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -40,16 +40,16 @@ func (s *SettingsForm) Merge(user *model.User) *model.User {
|
|||
// Validate makes sure the form values are valid.
|
||||
func (s *SettingsForm) Validate() error {
|
||||
if s.Username == "" || s.Theme == "" || s.Language == "" || s.Timezone == "" || s.EntryDirection == "" {
|
||||
return errors.NewLocalizedError("The username, theme, language and timezone fields are mandatory.")
|
||||
return errors.NewLocalizedError("error.settings_mandatory_fields")
|
||||
}
|
||||
|
||||
if s.Password != "" {
|
||||
if s.Password != s.Confirmation {
|
||||
return errors.NewLocalizedError("Passwords are not the same.")
|
||||
return errors.NewLocalizedError("error.different_passwords")
|
||||
}
|
||||
|
||||
if len(s.Password) < 6 {
|
||||
return errors.NewLocalizedError("You must use at least 6 characters")
|
||||
return errors.NewLocalizedError("error.password_min_length")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ type SubscriptionForm struct {
|
|||
// Validate makes sure the form values are valid.
|
||||
func (s *SubscriptionForm) Validate() error {
|
||||
if s.URL == "" || s.CategoryID == 0 {
|
||||
return errors.NewLocalizedError("The URL and the category are mandatory.")
|
||||
return errors.NewLocalizedError("error.feed_mandatory_fields")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
@ -22,15 +22,15 @@ type UserForm struct {
|
|||
// ValidateCreation validates user creation.
|
||||
func (u UserForm) ValidateCreation() error {
|
||||
if u.Username == "" || u.Password == "" || u.Confirmation == "" {
|
||||
return errors.NewLocalizedError("All fields are mandatory.")
|
||||
return errors.NewLocalizedError("error.fields_mandatory")
|
||||
}
|
||||
|
||||
if u.Password != u.Confirmation {
|
||||
return errors.NewLocalizedError("Passwords are not the same.")
|
||||
return errors.NewLocalizedError("error.different_passwords")
|
||||
}
|
||||
|
||||
if len(u.Password) < 6 {
|
||||
return errors.NewLocalizedError("You must use at least 6 characters.")
|
||||
return errors.NewLocalizedError("error.password_min_length")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -39,16 +39,16 @@ func (u UserForm) ValidateCreation() error {
|
|||
// ValidateModification validates user modification.
|
||||
func (u UserForm) ValidateModification() error {
|
||||
if u.Username == "" {
|
||||
return errors.NewLocalizedError("The username is mandatory.")
|
||||
return errors.NewLocalizedError("error.user_mandatory_fields")
|
||||
}
|
||||
|
||||
if u.Password != "" {
|
||||
if u.Password != u.Confirmation {
|
||||
return errors.NewLocalizedError("Passwords are not the same.")
|
||||
return errors.NewLocalizedError("error.different_passwords")
|
||||
}
|
||||
|
||||
if len(u.Password) < 6 {
|
||||
return errors.NewLocalizedError("You must use at least 6 characters.")
|
||||
return errors.NewLocalizedError("error.password_min_length")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue