Internationalize errors

This commit is contained in:
Erik Michaels-Ober 2011-09-14 17:36:44 -07:00
parent 0e225663d7
commit 91c73248d7
4 changed files with 7 additions and 3 deletions

View File

@ -6,7 +6,7 @@ class AddressesController < ApplicationController
unless @address.blank? unless @address.blank?
respond_with @address respond_with @address
else else
render(:json => {"errors" => {"address" => ["Could not find address."]}}, :status => 404) render(:json => {"errors" => {"address" => [t("errors.address")]}}, :status => 404)
end end
end end
end end

View File

@ -6,7 +6,7 @@ class HydrantsController < ApplicationController
unless @hydrants.blank? unless @hydrants.blank?
respond_with @hydrants respond_with @hydrants
else else
render(:json => {"errors" => {"address" => ["Could not find hydrants."]}}, :status => 404) render(:json => {"errors" => {"address" => [t("errors.hydrants")]}}, :status => 404)
end end
end end

View File

@ -9,7 +9,7 @@ class SessionsController < Devise::SessionsController
sign_in(resource_name, resource) sign_in(resource_name, resource)
render(:json => resource) render(:json => resource)
else else
render(:json => {"errors" => {:password => ["You need to sign in or sign up before continuing."]}}, :status => 401) render(:json => {"errors" => {:password => [t("errors.password")]}}, :status => 401)
end end
end end

View File

@ -25,6 +25,10 @@ en:
hydrant_name: "This hydrant" hydrant_name: "This hydrant"
tagline: "Claim responsibility for shoveling out a fire hydrant after it snows." tagline: "Claim responsibility for shoveling out a fire hydrant after it snows."
tos: "By signing up, you agree to the %{tos}." tos: "By signing up, you agree to the %{tos}."
errors:
address: "Could not find address."
password: "You need to sign in or sign up before continuing."
hydrants: "Could not find hydrants."
labels: labels:
address: "Address, Neighborhood" address: "Address, Neighborhood"
city_state: "City" city_state: "City"