Add translations for comment ajax controller

This commit is contained in:
Andreas Nedbal 2022-07-06 09:56:34 +02:00 committed by Karina Kwiatek
parent 7381a685ac
commit 15946740eb
3 changed files with 11 additions and 11 deletions

View File

@ -10,12 +10,12 @@ class Ajax::CommentController < AjaxController
rescue ActiveRecord::RecordInvalid => e
Sentry.capture_exception(e)
@response[:status] = :rec_inv
@response[:message] = I18n.t('messages.comment.create.rec_inv')
@response[:message] = t(".invalid")
return
end
@response[:status] = :okay
@response[:message] = I18n.t('messages.comment.create.okay')
@response[:message] = t(".success")
@response[:success] = true
@response[:render] = render_to_string(partial: 'answerbox/comments', locals: { a: answer })
@response[:count] = answer.comment_count
@ -29,7 +29,7 @@ class Ajax::CommentController < AjaxController
unless (current_user == comment.user) or (current_user == comment.answer.user) or (privileged? comment.user)
@response[:status] = :nopriv
@response[:message] = I18n.t('messages.comment.destroy.nopriv')
@response[:message] = t(".nopriv")
return
end
@ -37,7 +37,7 @@ class Ajax::CommentController < AjaxController
comment.destroy
@response[:status] = :okay
@response[:message] = I18n.t('messages.comment.destroy.okay')
@response[:message] = t(".success")
@response[:success] = true
end
end

View File

@ -6,6 +6,13 @@ en:
destroy:
nopriv: "Cannot remove a block belonging to someone else."
success: :ajax.relationship.destroy.block.success
comment:
create:
invalid: "Your comment is too long."
success: "Comment posted successfully."
destroy:
nopriv: "Can't delete other people's comments."
success: "Successfully deleted comment."
mute_rule:
nopriv: "Can't edit other people's rules"
create:

View File

@ -65,13 +65,6 @@ en:
destroy:
nopriv: "can't delete other people's answers"
okay: "Successfully deleted answer."
comment:
create:
rec_inv: "Your comment is too long."
okay: "Comment posted successfully."
destroy:
nopriv: "can't delete other people's comments"
okay: "Successfully deleted comment."
list:
create:
noname: "Please give that list a name."