From 15946740eba1613472c09c5500b8522c22ec1e8d Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Wed, 6 Jul 2022 09:56:34 +0200 Subject: [PATCH] Add translations for comment ajax controller --- app/controllers/ajax/comment_controller.rb | 8 ++++---- config/locales/controllers.en.yml | 7 +++++++ config/locales/en.yml | 7 ------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/controllers/ajax/comment_controller.rb b/app/controllers/ajax/comment_controller.rb index 7fce47e8..72dd305e 100644 --- a/app/controllers/ajax/comment_controller.rb +++ b/app/controllers/ajax/comment_controller.rb @@ -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 diff --git a/config/locales/controllers.en.yml b/config/locales/controllers.en.yml index 60025c63..5c1fd5cc 100644 --- a/config/locales/controllers.en.yml +++ b/config/locales/controllers.en.yml @@ -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: diff --git a/config/locales/en.yml b/config/locales/en.yml index ef1787b5..75b034cb 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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."