adding localisation for controller's flash messages'

This commit is contained in:
Claudius Coenen 2010-09-17 00:23:35 +02:00
parent aeedf2fc22
commit 5197c1b3ec
3 changed files with 19 additions and 5 deletions

View file

@ -17,7 +17,7 @@ class AlbumsController < ApplicationController
def create
aspect = params[:album][:to]
@album = current_user.post(:album, params[:album])
flash[:notice] = "You've created an album called #{@album.name}."
flash[:notice] = I18n.t('albums.create.success', :name => @album.name)
redirect_to :action => :show, :id => @album.id, :aspect => aspect
end
@ -28,7 +28,7 @@ class AlbumsController < ApplicationController
def destroy
@album = Album.find_by_id params[:id]
@album.destroy
flash[:notice] = "Album #{@album.name} deleted."
flash[:notice] = I18n.t('albums.destroy.success', :name => @album.name)
respond_with :location => albums_url
end
@ -48,10 +48,10 @@ class AlbumsController < ApplicationController
def update
@album = Album.find_params_by_id params[:id]
if @album.update_attributes params[:album]
flash[:notice] = "Album #{@album.name} successfully edited."
flash[:notice] = I18n.t('albums.update.success', :name => @album.name)
respond_with @album
else
flash[:error] = "Failed to edit album #{@album.name}."
flash[:error] = I18n.t('albums.update.failure', :name => @album.name)
render :action => :edit
end
end

View file

@ -30,6 +30,8 @@ de:
new_album:
create: "erstellen"
add_a_new_album: "Album hinzufügen"
create:
success: Du hast das Album %{name} erstellt.
show:
edit_album: "Album bearbeiten"
albums: "Alben"
@ -41,9 +43,14 @@ de:
are_you_sure: "Bist du sicher?"
delete_album: "Album löschen"
cancel: "Abbrechen"
update:
success: Album %{name} erfolgreich geändert.
failure: %{name} wurde nicht geändert.
index:
home: "Startseite"
new_album: "Neues Album"
destroy:
success: Album %{name} gelöscht.
aspects:
index:
photos: "Fotos"

View file

@ -30,6 +30,8 @@ en:
new_album:
create: "create"
add_a_new_album: "Add a new album"
create:
success: You've created an album called %{name}.
show:
edit_album: "Edit Album"
albums: "albums"
@ -41,10 +43,15 @@ en:
are_you_sure: "Are you sure?"
delete_album: "Delete Album"
cancel: "Cancel"
update:
success: Album %{name} successfully edited.
failure: Failed to edit album %{name}.
index:
home: "home"
new_album: "New Album"
aspects:
destroy:
success: Album %{name} deleted.
aspects:
index:
photos: "photos"
show: