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

View File

@ -6,6 +6,13 @@ en:
destroy: destroy:
nopriv: "Cannot remove a block belonging to someone else." nopriv: "Cannot remove a block belonging to someone else."
success: :ajax.relationship.destroy.block.success 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: mute_rule:
nopriv: "Can't edit other people's rules" nopriv: "Can't edit other people's rules"
create: create:

View File

@ -65,13 +65,6 @@ en:
destroy: destroy:
nopriv: "can't delete other people's answers" nopriv: "can't delete other people's answers"
okay: "Successfully deleted answer." 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: list:
create: create:
noname: "Please give that list a name." noname: "Please give that list a name."