also internationalize home controller

This commit is contained in:
wvengen 2013-02-04 02:12:24 +01:00
parent 1860e1c4cc
commit 9138f0da03
4 changed files with 12 additions and 5 deletions

View file

@ -16,7 +16,7 @@ class HomeController < ApplicationController
def update_profile def update_profile
if @current_user.update_attributes(params[:user]) if @current_user.update_attributes(params[:user])
redirect_to my_profile_url, notice: 'Änderungen wurden gespeichert.' redirect_to my_profile_url, notice: I18n.t('home.changes_saved')
else else
render :profile render :profile
end end
@ -45,7 +45,7 @@ class HomeController < ApplicationController
@financial_transactions = @financial_transactions.where("note LIKE ?", "%#{params[:query]}%") if params[:query].present? @financial_transactions = @financial_transactions.where("note LIKE ?", "%#{params[:query]}%") if params[:query].present?
else else
redirect_to root_path, :alert => "Leider bist Du kein Mitglied einer Bestellgruppe" redirect_to root_path, :alert => I18n.t('home.no_ordergroups')
end end
end end
@ -54,9 +54,9 @@ class HomeController < ApplicationController
membership = Membership.find(params[:membership_id]) membership = Membership.find(params[:membership_id])
if membership.user == current_user if membership.user == current_user
membership.destroy membership.destroy
flash[:notice] = "Du bist jetzt kein Mitglied der Gruppe #{membership.group.name} mehr." flash[:notice] = I18n.t('home.ordergroup_cancelled', :group => membership.group.name)
else else
flash[:error] = "Ein Problem ist aufgetreten." flash[:error] = I18n.t('errors.general')
end end
redirect_to my_profile_path redirect_to my_profile_path
end end

View file

@ -119,6 +119,7 @@ de:
second: Sekunden second: Sekunden
year: Jahr year: Jahr
errors: &errors errors: &errors
general: 'Ein Problem ist aufgetreten.'
format: ! '%{attribute} %{message}' format: ! '%{attribute} %{message}'
messages: messages:
accepted: muss akzeptiert werden accepted: muss akzeptiert werden
@ -262,4 +263,4 @@ de:
message: message:
create: 'Nachricht verschicken' create: 'Nachricht verschicken'
invite: invite:
create: Einladung verschicken create: Einladung verschicken

View file

@ -78,3 +78,8 @@ de:
cancel: 'Mitgliedschaft beenden' cancel: 'Mitgliedschaft beenden'
cancel_confirm: 'Bist Du sicher, dass Du Deine Mitgliedschaft beenden willst?' cancel_confirm: 'Bist Du sicher, dass Du Deine Mitgliedschaft beenden willst?'
# used by controller
changes_saved: 'Änderungen wurden gespeichert.'
no_ordergroups: 'Leider bist Du kein Mitglied einer Bestellgruppe'
ordergroup_cancelled: 'Du bist jetzt kein Mitglied der Gruppe %{group} mehr.'

View file

@ -119,6 +119,7 @@ en:
second: seconds second: seconds
year: years year: years
errors: &errors errors: &errors
general: 'A problem has occured.'
format: ! '%{attribute} %{message}' format: ! '%{attribute} %{message}'
messages: messages:
accepted: has to be accepted accepted: has to be accepted