From f95cebcb8bbfa3aba5ad4957de166fa94f081486 Mon Sep 17 00:00:00 2001 From: Ariel Zavala <arielo.zavala@gmail.com> Date: Fri, 17 Sep 2010 16:38:50 -0400 Subject: [PATCH] Added translations to new requests view and aspects controller --- app/controllers/aspects_controller.rb | 14 +++++++------- app/views/requests/_new_request.haml | 8 ++++---- config/locales/de.yml | 12 ++++++++++++ config/locales/en.yml | 18 +++++++++++++++++- config/locales/es.yml | 16 ++++++++++++++++ config/locales/fr.yml | 12 ++++++++++++ 6 files changed, 68 insertions(+), 12 deletions(-) diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 82c35b36c9..5d572742af 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -29,7 +29,7 @@ class AspectsController < ApplicationController begin current_user.drop_aspect @aspect - flash[:notice] = "#{@aspect.name} was successfully removed." + flash[:notice] = i18n.t 'aspects.destroy.success',:name => @aspect.name rescue RuntimeError => e flash[:error] = e.message end @@ -53,7 +53,7 @@ class AspectsController < ApplicationController def update @aspect = Aspect.find_by_id(params[:id]) @aspect.update_attributes(params[:aspect]) - flash[:notice] = "Your aspect, #{@aspect.name}, has been successfully edited." + flash[:notice] = i18n.t 'aspects.update.success',:name => @aspect.name respond_with @aspect end @@ -61,25 +61,25 @@ class AspectsController < ApplicationController params[:moves].each{ |move| move = move[1] unless current_user.move_friend(move) - flash[:error] = "Aspect editing failed for friend #{Person.find_by_id( move[:friend_id] ).real_name}." + flash[:error] = i18n.t 'aspects.move_friends.failure', :real_name => Person.find_by_id( move[:friend_id] ).real_name redirect_to Aspect.first, :action => "edit" return end } - flash[:notice] = "Aspects edited successfully." + flash[:notice] = i18n.t 'aspects.move_friends.success' redirect_to Aspect.first, :action => "edit" end def move_friend unless current_user.move_friend( :friend_id => params[:friend_id], :from => params[:from], :to => params[:to][:to]) - flash[:error] = "didn't work #{params.inspect}" + flash[:error] = I18n.t 'aspects.move_friend.error',:inspect => params.inspect end if aspect = Aspect.first(:id => params[:to][:to]) - flash[:notice] = "You are now showing your friend a different aspect of yourself." + flash[:notice] = I18n.t 'aspects.move_friend.notice' respond_with aspect else - flash[:notice] = "You are now showing your friend a different aspect of yourself." + flash[:notice] = I18n.t 'aspects.move_friend.notice' respond_with Person.first(:id => params[:friend_id]) end end diff --git a/app/views/requests/_new_request.haml b/app/views/requests/_new_request.haml index b7e5819f69..70c204e7cb 100644 --- a/app/views/requests/_new_request.haml +++ b/app/views/requests/_new_request.haml @@ -4,18 +4,18 @@ %h1 - Add a new friend to + =t('.add_a_new_friend_to') %i= aspect.name = form_for Request.new do |f| = f.error_messages - Enter a Diaspora username: + =t('.enter_a_diaspora_username') %br - %i= "Your Diaspora username is: #{current_user.diaspora_handle}" + %i= t '.your_diaspora_username_is', :diaspora_handle => current_user.diaspora_handle %p - = f.label :destination_url, "Friend's username" + = f.label :destination_url, t(".friends_username") = f.text_field :destination_url = f.hidden_field :aspect_id, :value => aspect.id = f.submit diff --git a/config/locales/de.yml b/config/locales/de.yml index 06fb5e6cb6..07ff690d7b 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -84,6 +84,18 @@ de: new_aspect: add_a_new_aspect: "Neuen Aspekt erstellen" create: "Erstellen" + create: + success: "Click on the plus on the left side to tell Diaspora who can see your new aspect." + destroy: + success: "%{name} was successfully removed." + update: + success: "Your aspect, %{name}, has been successfully edited." + move_friends: + failure: "Aspect editing failed for friend %{real_name}." + success: "Aspects edited successfully." + move_friend: + error: "didn't work %{inspect}" + notice: "You are now showing your friend a different aspect of yourself." helper: remove: "remove" aspect_not_empty: "Aspect not empty" diff --git a/config/locales/en.yml b/config/locales/en.yml index f4dc9d076a..cd8055775c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -85,7 +85,17 @@ en: add_a_new_aspect: "Add a new aspect" create: "Create" create: - success:"Click on the plus on the left side to tell Diaspora who can see your new aspect." + success: "Click on the plus on the left side to tell Diaspora who can see your new aspect." + destroy: + success: "%{name} was successfully removed." + update: + success: "Your aspect, %{name}, has been successfully edited." + move_friends: + failure: "Aspect editing failed for friend %{real_name}." + success: "Aspects edited successfully." + move_friend: + error: "didn't work %{inspect}" + notice: "You are now showing your friend a different aspect of yourself." helper: remove: "remove" aspect_not_empty: "Aspect not empty" @@ -164,3 +174,9 @@ en: save: "save" are_you_sure: "Are you sure?" remove_friend: "remove friend" + requests: + new_request: + add_a_new_friend_to: "Add a new friend to" + enter_a_diaspora_username: "Enter a Diaspora username:" + your_diaspora_username_is: "Your Diaspora username is: %{diaspora_handle}" + friends_username: "Friend's username" diff --git a/config/locales/es.yml b/config/locales/es.yml index 7243c73a5a..b9c11e4a6a 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -87,6 +87,16 @@ es: create: "Crear" create: success:"Pulsa en el signo de mas a la izquierda para escojer quien puede ver su nuevo aspecto." + destroy: + success: "%{name} fue removido exitosamente." + update: + success: "Su aspecto, %{name}, fue editado exitosamente." + move_friends: + failure: "Fallo el editar aspecto para el amigo %{real_name}." + success: "Los aspectos fueron editados exitosamente." + move_friend: + error: "no funciono %{inspect}" + notice: "Ahora estas mostrando a tu amigo un aspecto diferente de ti." helper: remove: "remover" aspect_not_empty: "Aspecto no esta vacio" @@ -162,3 +172,9 @@ es: save: "guardar" are_you_sure: "Esta seguro?" remove_friend: "remover amigo" + requests: + new_request: + add_a_new_friend_to: "Añade un nuevo amigo a " + enter_a_diaspora_username: "Escribe el usuario de Diaspora:" + your_diaspora_username_is: "Tu usuario de Diaspora es: %{diaspora_handle}" + friends_username: "Usuario de amigo" diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 0384d4577e..7d58cd4aa9 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -78,6 +78,18 @@ fr: new_aspect: add_a_new_aspect: "Ajouter un nouvel aspect" create: "Créer" + create: + success: "Click on the plus on the left side to tell Diaspora who can see your new aspect." + destroy: + success: "%{name} was successfully removed." + update: + success: "Your aspect, %{name}, has been successfully edited." + move_friends: + failure: "Aspect editing failed for friend %{real_name}." + success: "Aspects edited successfully." + move_friend: + error: "didn't work %{inspect}" + notice: "You are now showing your friend a different aspect of yourself." helper: remove: "remove" aspect_not_empty: "Aspect not empty" -- GitLab