i18n of flash error for blank comment. fixes #30
This commit is contained in:
parent
b2f4156ab8
commit
6c39cb4784
|
@ -31,13 +31,13 @@ class Comment < ActiveRecord::Base
|
|||
|
||||
validate do
|
||||
self.comment.to_s.strip == "" &&
|
||||
errors.add(:comment, "cannot be blank.")
|
||||
errors.add(" ", I18n.t( 'models.comment.commentcannotbeblank'))
|
||||
|
||||
self.user_id.blank? &&
|
||||
errors.add(:user_id, "cannot be blank.")
|
||||
errors.add(" ", I18n.t( 'models.comment.useridcannotbeblank'))
|
||||
|
||||
self.story_id.blank? &&
|
||||
errors.add(:story_id, "cannot be blank.")
|
||||
errors.add(" ", I18n.t( 'models.comment.storyidcannotbeblank'))
|
||||
|
||||
(m = self.comment.to_s.strip.match(/\A(t)his([\.!])?$\z/i)) &&
|
||||
errors.add(:base, (m[1] == "T" ? "N" : "n") + "ope" + m[2].to_s)
|
||||
|
|
|
@ -10,6 +10,9 @@ en:
|
|||
subject: "[%{appname}] You have been invited to %{appname}"
|
||||
models:
|
||||
comment:
|
||||
commentcannotbeblank: "A comment cannot be blank."
|
||||
useridcannotbeblank: "A user ID cannot be blank."
|
||||
storyidcannotbeblank: "A story ID cannot be blank."
|
||||
deletedcomment: "deleted comment"
|
||||
threadremovedby: "Thread removed by moderator %{modoname} : %{modreason}"
|
||||
moderation:
|
||||
|
|
|
@ -22,6 +22,9 @@ fr:
|
|||
subject: "[%{appname}] Vous avez été invité au %{appname}"
|
||||
models:
|
||||
comment:
|
||||
commentcannotbeblank: "Un commentaire ne peut pas être vide."
|
||||
useridcannotbeblank: "Un ID utilisateur ne peut pas être vide."
|
||||
storyidcannotbeblank: "Un ID d'info ne peut pas être vide."
|
||||
deletedcomment: "commentaire supprimé"
|
||||
threadremovedby: "Fil supprimé par le modérateur %{modoname} : %{modreason}"
|
||||
moderation:
|
||||
|
|
Loading…
Reference in a new issue