From c1c20e14f7573fc72917570862161b98995c39d4 Mon Sep 17 00:00:00 2001
From: Ariel Zavala <arielo.zavala@gmail.com>
Date: Fri, 17 Sep 2010 17:05:54 -0400
Subject: [PATCH] Added translations to requests controller

---
 app/controllers/requests_controller.rb | 14 +++++++-------
 config/locales/de.yml                  |  9 +++++++++
 config/locales/en.yml                  |  9 +++++++++
 config/locales/es.yml                  | 13 +++++++++++--
 config/locales/fr.yml                  | 10 ++++++++++
 5 files changed, 46 insertions(+), 9 deletions(-)

diff --git a/app/controllers/requests_controller.rb b/app/controllers/requests_controller.rb
index 6087ebe857..2586592c29 100644
--- a/app/controllers/requests_controller.rb
+++ b/app/controllers/requests_controller.rb
@@ -13,15 +13,15 @@ class RequestsController < ApplicationController
     if params[:accept]
       if params[:aspect_id]
         @friend = current_user.accept_and_respond( params[:id], params[:aspect_id])
-        flash[:notice] = "You are now friends."
+        flash[:notice] = I18n.t 'requests.destroy.success'
         respond_with :location => current_user.aspect_by_id(params[:aspect_id])
       else
-        flash[:error] = "Please select an aspect!"
+        flash[:error] = I18n.t 'requests.destroy.error'
         respond_with :location => requests_url
       end
     else
       current_user.ignore_friend_request params[:id]
-      flash[:notice] = "Ignored friend request."
+      flash[:notice] = I18n.t 'requests.destroy.ignore'
       respond_with :location => requests_url
     end
   end
@@ -37,7 +37,7 @@ class RequestsController < ApplicationController
       rel_hash = relationship_flow(params[:request][:destination_url])
     rescue Exception => e
       raise e unless e.message.include? "not found"
-      flash[:error] = "No diaspora seed found with this email!"
+      flash[:error] = I18n.t 'requests.create.error'
       respond_with :location => aspect
       return
     end
@@ -48,16 +48,16 @@ class RequestsController < ApplicationController
       @request = current_user.send_friend_request_to(rel_hash[:friend], aspect)
     rescue Exception => e
       raise e unless e.message.include? "already friends"
-      flash[:notice] = "You are already friends with #{params[:request][:destination_url]}!"
+      flash[:notice] = I18n.t 'requests.create.already_friends', :destination_url => params[:request][:destination_url]
       respond_with :location => aspect
       return
     end
 
     if @request
-      flash[:notice] =  "A friend request was sent to #{@request.destination_url}."
+      flash[:notice] =  I18n.t 'requests.create.success',:destination_url => @request.destination_url
       respond_with :location => aspect
     else
-      flash[:error] = "Something went horribly wrong."
+      flash[:error] = I18n.t 'requests.create.horribly_wrong'
       respond_with :location => aspect
     end
   end
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 07ff690d7b..d34e29fe59 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -175,3 +175,12 @@ de:
           save: "save"
           are_you_sure: "Are you sure?"
           remove_friend: "remove friend"
+      destroy:
+          success: "You are now friends."
+          error: "Please select an aspect!"
+          ignore: "Ignored friend request."
+      create:
+          error: "No diaspora seed found with this email!"
+          already_friends: "You are already friends with %{destination_url}!"
+          success: "A friend request was sent to %{destination_url}."
+          horribly_wrong: "Something went horribly wrong."
diff --git a/config/locales/en.yml b/config/locales/en.yml
index cd8055775c..5c9e797add 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -180,3 +180,12 @@ en:
           enter_a_diaspora_username: "Enter a Diaspora username:"
           your_diaspora_username_is: "Your Diaspora username is: %{diaspora_handle}"
           friends_username: "Friend's username"
+      destroy:
+          success: "You are now friends."
+          error: "Please select an aspect!"
+          ignore: "Ignored friend request."
+      create:
+          error: "No diaspora seed found with this email!"
+          already_friends: "You are already friends with %{destination_url}!"
+          success: "A friend request was sent to %{destination_url}."
+          horribly_wrong: "Something went horribly wrong."
diff --git a/config/locales/es.yml b/config/locales/es.yml
index b9c11e4a6a..524633310a 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -30,11 +30,11 @@ es:
           logout: "desloguear"
   shared:
       aspect_nav:
-          all_aspects: "Todo los Aspectos"
+          all_aspects: "Todos los Aspectos"
           manage: "Manejar"
           manage_your_aspects: "Maneja tus Aspectos"
       sub_header:
-          all_aspects: "Todo los Aspectos"
+          all_aspects: "Todos los Aspectos"
           manage_aspects: "Manejar Aspectos"
       publisher:
           share: "Compartir"
@@ -178,3 +178,12 @@ es:
           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"
+      destroy:
+          success: "Ahora son amigos."
+          error: "Seleccione un aspecto!"
+          ignore: "Ignorar peticion de amistad"
+      create:
+          error: "No diaspora seed found with this email!"
+          already_friends: "Ya eres amigo de %{destination_url}!"
+          success: "Una peticion de amistad se envio a %{destination_url}."
+          horribly_wrong: "Algo horriblemente mal sucedio"
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 7d58cd4aa9..383e136e59 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -166,3 +166,13 @@ fr:
           save: "save"
           are_you_sure: "Are you sure?"
           remove_friend: "remove friend"
+      destroy:
+          success: "You are now friends."
+          error: "Please select an aspect!"
+          ignore: "Ignored friend request."
+      create:
+          error: "No diaspora seed found with this email!"
+          already_friends: "You are already friends with %{destination_url}!"
+          success: "A friend request was sent to %{destination_url}."
+          horribly_wrong: "Something went horribly wrong."          
+
-- 
GitLab