From 0ea2741bd45dec8d2c5c4d7e9c7d51775244ec81 Mon Sep 17 00:00:00 2001
From: Marcela Ribeiro de Oliveira <mro15@inf.ufpr.br>
Date: Mon, 21 Mar 2016 08:47:05 -0300
Subject: [PATCH] add translation in .yml

---
 app/controllers/collections_controller.rb     |  6 +--
 app/controllers/complaints_controller.rb      |  4 +-
 app/controllers/feedbacks_controller.rb       |  2 +-
 .../learning_objects_controller.rb            |  6 +--
 config/locales/pt-BR.yml                      | 39 ++++++++++++++++++-
 5 files changed, 47 insertions(+), 10 deletions(-)

diff --git a/app/controllers/collections_controller.rb b/app/controllers/collections_controller.rb
index d4aee9e51..fd8ca3a09 100644
--- a/app/controllers/collections_controller.rb
+++ b/app/controllers/collections_controller.rb
@@ -60,7 +60,7 @@ class CollectionsController < ApplicationController
 
     respond_to do |format|
       if @collection.save
-        format.html { redirect_to :back, notice: 'Coleção criada com sucesso.' }
+        format.html { redirect_to :back, notice: t('activerecord.attributes.collection.create.notice.successfully_created') }
       else
         format.html { render :new }
       end
@@ -72,7 +72,7 @@ class CollectionsController < ApplicationController
   def update
     respond_to do |format|
       if Collection.update(collection_params)
-        format.html { redirect_to @collection, notice: 'Coleção atualizada com sucesso.' }
+        format.html { redirect_to @collection, notice: t('activerecord.attributes.collection.update.notice.successfully_updated') }
       else
         format.html { render :edit }
       end
@@ -85,7 +85,7 @@ class CollectionsController < ApplicationController
     Collection.destroy @collection
 
     respond_to do |format|
-      format.html { redirect_to user_path(current_user), notice: 'Coleção excluida com sucesso.' }
+      format.html { redirect_to user_path(current_user), notice: t('activerecord.attributes.collection.destroy.notice.successfully_destroy') }
     end
   end
 
diff --git a/app/controllers/complaints_controller.rb b/app/controllers/complaints_controller.rb
index c83724f23..bce93bf58 100644
--- a/app/controllers/complaints_controller.rb
+++ b/app/controllers/complaints_controller.rb
@@ -10,9 +10,9 @@ class ComplaintsController < ApplicationController
 
     respond_to do |format|
       if complaint.save
-        format.html { redirect_to :back, notice: 'Denúncia realizada com sucesso.' }
+        format.html { redirect_to :back, notice: t('activerecord.attributes.complaint.create.notice.sucess') }
       else
-        format.html { redirect_to :back, alert: 'Objeto já foi denunciado por você.' }
+        format.html { redirect_to :back, alert: t('activerecord.attributes.complaint.create.alert.fail') }
       end
     end
   end
diff --git a/app/controllers/feedbacks_controller.rb b/app/controllers/feedbacks_controller.rb
index e511d6025..bf391b700 100644
--- a/app/controllers/feedbacks_controller.rb
+++ b/app/controllers/feedbacks_controller.rb
@@ -32,7 +32,7 @@ class FeedbacksController < ApplicationController
 
     respond_to do |format|
       if feedback_service.report_bug @bug
-        format.html { redirect_to :back, notice: 'Problema relatado com sucesso!' }
+        format.html { redirect_to :back, notice: t('activerecord.attributes.feedback.report_bug.notice.success') }
       end
     end
   end
diff --git a/app/controllers/learning_objects_controller.rb b/app/controllers/learning_objects_controller.rb
index 2a492b4e5..0f40b94dc 100644
--- a/app/controllers/learning_objects_controller.rb
+++ b/app/controllers/learning_objects_controller.rb
@@ -40,7 +40,7 @@ class LearningObjectsController < ApplicationController
         # go to file submission page
         format.html { success_redirect @learning_object }
       else
-        format.html { render :new, notice: 'Não foi possível criar o objeto.' }
+        format.html { render :new, notice:  t('activerecord.attributes.learning_object.create.notice.failure') }
       end
     end
 
@@ -64,7 +64,7 @@ class LearningObjectsController < ApplicationController
     LearningObject.destroy @learning_object
 
     respond_to do |format|
-      format.html { redirect_to learning_objects_url, notice: 'Objeto educacional excluído com sucesso.' }
+      format.html { redirect_to learning_objects_url, notice: t('activerecord.attributes.learning_object.destroy.notice.successfully_destroy') }
     end
   end
 
@@ -121,7 +121,7 @@ class LearningObjectsController < ApplicationController
 
   def success_redirect(learning_object)
     #if 'Website externo' == learning_object.object_type.name
-    redirect_to learning_object_build_path(learning_object, :upload_attachments), notice: 'Seu objeto foi criado com sucesso!'
+    redirect_to learning_object_build_path(learning_object, :upload_attachments), notice: t('activerecord.attributes.learning_object.success_redirect.notice.successfully_created')
   end
 
   def set_form_objects
diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml
index 6670a9dce..89aaf5fd8 100644
--- a/config/locales/pt-BR.yml
+++ b/config/locales/pt-BR.yml
@@ -137,8 +137,45 @@ pt-BR:
         object_type: "Tipo do objeto"
         language: "Idioma"
         author: "Autor"
+        create:
+          notice:
+            failure: "Não foi possível criar o objeto."
+        destroy:
+          notice:
+            successfully_destroy: "Objeto educacional excluído com sucesso."
+        success_redirect:
+          notice:
+              successfully_created: "Seu objeto educacional foi criado com sucesso!"  
+      collection:
+        create:
+          notice:
+            successfully_created: "Coleção criada com sucesso."
+        update:
+          notice:
+            sucessfully_updated: "Coleção atualizada com sucesso."
+        destroy:
+          notice:
+            successfully_destroy: "Coleção excluída com sucesso."
+      complaint:
+        create:
+          notice:
+            sucess: "Denúncia realizada com sucesso."
+          alert:
+            fail: "Objeto já foi denunciado por você."
+      feedback:
+        report_bug:
+          notice:
+            sucess: "Problema relatado com sucesso!"
       institution:
-        name: "Nome"
+        create:
+          notice:
+            successfully_created: "Instituição criada com sucesso."
+        update:
+          notice:
+            sucessfully_updated: "Instituição atualizada com sucesso."
+        destroy:
+          notice:
+            successfully_destroy: "Instituição excluída com sucesso."
       review:
         create:
           notice:
-- 
GitLab