Add internationalization (#114)

🇬🇧 and 🇮🇹
This commit is contained in:
Riccardo Graziosi
2022-06-05 11:40:43 +02:00
committed by GitHub
parent ba86e81aa0
commit 78049a820c
71 changed files with 802 additions and 266 deletions

View File

@@ -33,7 +33,7 @@ class PostsController < ApplicationController
render json: post, status: :created
else
render json: {
error: I18n.t('errors.post.create', message: post.errors.full_messages)
error: post.errors.full_messages
}, status: :unprocessable_entity
end
end
@@ -54,7 +54,7 @@ class PostsController < ApplicationController
post = Post.find(params[:id])
if !current_user.power_user? && current_user.id != post.user_id
render json: I18n.t('errors.unauthorized'), status: :unauthorized
render json: t('backend.errors.unauthorized'), status: :unauthorized
return
end
@@ -83,7 +83,7 @@ class PostsController < ApplicationController
render json: post, status: :no_content
else
render json: {
error: I18n.t('errors.post.update', message: post.errors.full_messages)
error: post.errors.full_messages
}, status: :unprocessable_entity
end
end