From 4558f9901efe2408e49c8e8ae667b2b715da6dff Mon Sep 17 00:00:00 2001 From: Ariel Zavala Date: Fri, 17 Sep 2010 18:25:36 -0400 Subject: [PATCH] Added translations to photos and registrations controllers --- app/controllers/photos_controller.rb | 12 ++++++------ app/controllers/registrations_controller.rb | 2 +- config/locales/de.yml | 11 +++++++++++ config/locales/en.yml | 11 +++++++++++ config/locales/es.yml | 11 +++++++++++ config/locales/fr.yml | 11 +++++++++++ 6 files changed, 51 insertions(+), 7 deletions(-) diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index cefc8f5d6..203a748f6 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -40,15 +40,15 @@ class PhotosController < ApplicationController end rescue TypeError - message = "Photo upload failed. Are you sure an image was added?" + message = I18n.t 'photos.create.type_error' respond_with :location => album, :error => message rescue CarrierWave::IntegrityError - message = "Photo upload failed. Are you sure that was an image?" + message = I18n.t 'photos.create.integrity_error' respond_with :location => album, :error => message rescue RuntimeError => e - message = "Photo upload failed. Are you sure that your seatbelt is fastened?" + message = I18n.t 'photos.create.runtime_error' respond_with :location => album, :error => message raise e end @@ -63,7 +63,7 @@ class PhotosController < ApplicationController def destroy @photo = Photo.find_by_id params[:id] @photo.destroy - flash[:notice] = "Photo deleted." + flash[:notice] = I18n.t 'photos.destroy.notice' respond_with :location => @photo.album end @@ -84,10 +84,10 @@ class PhotosController < ApplicationController def update @photo = Photo.find_by_id params[:id] if @photo.update_attributes params[:photo] - flash[:notice] = "Photo successfully updated." + flash[:notice] = I18n.t 'photos.update.notice' respond_with @photo else - flash[:error] = "Failed to edit photo." + flash[:error] = I18n.t 'photos.update.error' render :action => :edit end end diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 8241aa294..854f19e1a 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -16,7 +16,7 @@ class RegistrationsController < Devise::RegistrationsController end if user #set_flash_message :notice, :signed_up - flash[:notice] = "You've joined Diaspora!" + flash[:notice] = I18n.t 'registrations.create.success' #redirect_to root_url sign_in_and_redirect(:user, user) else diff --git a/config/locales/de.yml b/config/locales/de.yml index d34e29fe5..aabe057cd 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -137,9 +137,20 @@ de: new_photo: "Foto erstellen" back_to_list: "Zurück zur Liste" post_it: "Hochladen" + create: + runtime_error: "Photo upload failed. Are you sure that your seatbelt is fastened?" + integrity_error: "Photo upload failed. Are you sure that was an image?" + type_error: "Photo upload failed. Are you sure an image was added?" + update: + notice: "Photo successfully updated." + error: "Failed to edit photo." + destroy: + notice: "Photo deleted." registrations: new: sign_up: "Anmelden" + create: + success: "You've joined Diaspora!" status_messages: new_status_message: tell_me_something_good: "Erzähl' mir was schönes!" diff --git a/config/locales/en.yml b/config/locales/en.yml index 5c9e797ad..3a416b54f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -136,9 +136,20 @@ en: new_photo: "New Photo" back_to_list: "Back to List" post_it: "post it!" + create: + runtime_error: "Photo upload failed. Are you sure that your seatbelt is fastened?" + integrity_error: "Photo upload failed. Are you sure that was an image?" + type_error: "Photo upload failed. Are you sure an image was added?" + update: + notice: "Photo successfully updated." + error: "Failed to edit photo." + destroy: + notice: "Photo deleted." registrations: new: sign_up: "Sign up" + create: + success: "You've joined Diaspora!" status_messages: new_status_message: tell_me_something_good: "tell me something good" diff --git a/config/locales/es.yml b/config/locales/es.yml index 524633310..de2617886 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -137,9 +137,20 @@ es: new_photo: "Nueva Foto" back_to_list: "Devuelta a la lista" post_it: "post it!" + create: + runtime_error: "Photo upload failed. Are you sure that your seatbelt is fastened?" + integrity_error: "Photo upload failed. Are you sure that was an image?" + type_error: "Photo upload failed. Are you sure an image was added?" + update: + notice: "Photo successfully updated." + error: "Failed to edit photo." + destroy: + notice: "Photo deleted." registrations: new: sign_up: "Registrate" + create: + success: "Esta registrado en Diaspora!" status_messages: new_status_message: tell_me_something_good: "dime algo bueno" diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 383e136e5..9a0ac8d22 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -128,9 +128,20 @@ fr: new_photo: "Nouvelle photo" back_to_list: "Retour à la liste" post_it: "postez le !" + create: + runtime_error: "Photo upload failed. Are you sure that your seatbelt is fastened?" + integrity_error: "Photo upload failed. Are you sure that was an image?" + type_error: "Photo upload failed. Are you sure an image was added?" + update: + notice: "Photo successfully updated." + error: "Failed to edit photo." + destroy: + notice: "Photo deleted." registrations: new: sign_up: "Enregistrement" + create: + success: "You've joined Diaspora!" status_messages: new_status_message: tell_me_something_good: "Dites quelque-chose de bien"