Add translations for block/relationship ajax controllers

This commit is contained in:
Andreas Nedbal 2022-07-06 09:21:15 +02:00 committed by Karina Kwiatek
parent 8a6a9c21ec
commit 34de119bb1
4 changed files with 26 additions and 20 deletions

View File

@ -15,7 +15,7 @@ class Ajax::AnonymousBlockController < AjaxController
question.inboxes.first.destroy
@response[:status] = :okay
@response[:message] = I18n.t("messages.block.create.okay")
@response[:message] = t(".success")
@response[:success] = true
end
@ -25,13 +25,13 @@ class Ajax::AnonymousBlockController < AjaxController
block = AnonymousBlock.find(params[:id])
if current_user != block.user
@response[:status] = :nopriv
@response[:message] = I18n.t("messages.block.destroy.nopriv")
@response[:message] = t(".nopriv")
end
block.destroy!
@response[:status] = :okay
@response[:message] = I18n.t("messages.block.destroy.okay")
@response[:message] = t(".success")
@response[:success] = true
end
end

View File

@ -16,7 +16,7 @@ class Ajax::RelationshipController < AjaxController
type: params[:type]
)
@response[:success] = true
@response[:message] = t("messages.#{params[:type]}.create.okay")
@response[:message] = t(".#{params[:type]}.success")
rescue Errors::Base => e
@response[:message] = t(e.locale_tag)
ensure
@ -30,7 +30,7 @@ class Ajax::RelationshipController < AjaxController
type: params[:type]
)
@response[:success] = true
@response[:message] = t("messages.#{params[:type]}.destroy.okay")
@response[:message] = t(".#{params[:type]}.success")
rescue Errors::Base => e
@response[:message] = t(e.locale_tag)
ensure

View File

@ -1,5 +1,11 @@
en:
ajax:
anonymous_block:
create:
success: :ajax.relationship.create.block.success
destroy:
nopriv: "Cannot remove a block belonging to someone else."
success: :ajax.relationship.destroy.block.success
mute_rule:
nopriv: "Can't edit other people's rules"
create:
@ -13,6 +19,21 @@ en:
noauth: :messages.noauth
nopriv: :ajax.mute_rule.nopriv
success: "Rule deleted successfully."
relationship:
create:
block:
success: "Successfully blocked user."
error: "You are already blocking that user."
follow:
success: "Successfully followed user."
error: "You are already following that user."
destroy:
block:
success: "Successfully unblocked user."
error: "You are not blocking that user."
follow:
success: "Successfully unfollowed user."
error: "You are not following that user."
announcement:
create:
success: "Announcement created successfully."

View File

@ -72,21 +72,6 @@ en:
destroy:
nopriv: "can't delete other people's comments"
okay: "Successfully deleted comment."
follow:
create:
fail: "You are already following that user."
okay: "Successfully followed user."
destroy:
fail: "You are not following that user."
okay: "Successfully unfollowed user."
block:
create:
fail: "You are already blocking that user."
okay: "Successfully blocked user."
destroy:
fail: "You are not blocking that user."
okay: "Successfully unblocked user."
nopriv: "Cannot remove a block belonging to someone else."
list:
create:
noname: "Please give that list a name."