diff --git a/app/controllers/api/v0/guidance_groups_controller.rb b/app/controllers/api/v0/guidance_groups_controller.rb index 3eafd8a..29ee861 100644 --- a/app/controllers/api/v0/guidance_groups_controller.rb +++ b/app/controllers/api/v0/guidance_groups_controller.rb @@ -27,10 +27,10 @@ if GuidanceGroup.can_view(@user, params[:id]) respond_with get_resource else - render json: '"You do not have authorization to view this"', status: 401 + render json: I18n.t("api.bad_resource"), status: 401 end else - render json: '"You do not have authorization to use this api endpoint"', status: 401 + render json: I18n.t("api.no_auth_for_endpoint"), status: 401 end end @@ -49,7 +49,7 @@ respond_with @all_viewable_groups else #render unauthorised - render json: '"You do not have authorization to use this api endpoint"', status: 401 + render json: I18n.t("api.no_auth_for_endpoint"), status: 401 end end diff --git a/app/controllers/api/v0/guidances_controller.rb b/app/controllers/api/v0/guidances_controller.rb index 0f1ff43..679244f 100644 --- a/app/controllers/api/v0/guidances_controller.rb +++ b/app/controllers/api/v0/guidances_controller.rb @@ -26,10 +26,10 @@ if Guidance.can_view(@user, params[:id]) respond_with get_resource else - render json: '"you do not have authorisation to view this resource"', status: 401 + render json: I18n.t("api.bad_resource"), status: 401 end else - render json: '"You do not have authorisation to use this api endpoint"', status: 401 + render I18n.t("api.no_auth_for_endpoint"), status: 401 end end @@ -45,7 +45,7 @@ @all_viewable_guidances = Guidance.all_viewable(@user) respond_with @all_viewable_guidances else - render json '"You do not have authorisation to view this api endpoint"', status: 401 + render json I18n.t("api.no_auth_for_endpoint"), status: 401 end end diff --git a/app/controllers/api/v0/projects_controller.rb b/app/controllers/api/v0/projects_controller.rb index aa6cabb..fd33c94 100644 --- a/app/controllers/api/v0/projects_controller.rb +++ b/app/controllers/api/v0/projects_controller.rb @@ -34,15 +34,15 @@ dmptemplate = organization.templates.find_by title: params[:template][:name] # else error: organization has more than one template and template name unspecified else - render json: 'error:"Organization has more than one template and template name unspecified or invalid"', status: 400 and return + render json: I18n.t("api.org_multiple_templates"), status: 400 and return end # else error: organization specified is not a funder else - render json: 'error:"Organization specified is not a funder"', status: 400 and return + render json: I18n.t("api.org_not_funder"), status: 400 and return end # else error: organization does not exist else - render json: 'error:"Organization does not exist"', status: 400 and return + render json: I18n.t("api.org_dosent_exist"), status: 400 and return end all_groups = [] @@ -86,7 +86,7 @@ render json: get_resource.errors, status: :unprocessable_entity end else - render json: 'error:"You do not have authorisation to view this api endpoint"', status: 400 and return + render json: I18n.t("api.no_auth_for_endpoint"), status: 400 and return end end