diff --git a/app/controllers/votes_controller.rb b/app/controllers/votes_controller.rb
index d3c35a220..6ca2d45b2 100644
--- a/app/controllers/votes_controller.rb
+++ b/app/controllers/votes_controller.rb
@@ -4,7 +4,7 @@ class VotesController < ApplicationController
def create
register_vote
- notice = @debate.vote_registered? ? "Gracias por votar." : "Tu voto ya ha sido registrado."
+ notice = @debate.vote_registered? ? I18n.t("votes.notice_thanks") : I18n.t("votes.notice_already_registered")
redirect_to @debate, notice: notice
end
@@ -12,7 +12,7 @@ class VotesController < ApplicationController
def set_debate
@debate = Debate.find(params[:debate_id])
- end
+ end
def register_vote
@debate.vote_by voter: current_user, vote: params[:value]
diff --git a/app/views/debates/_debate.html.erb b/app/views/debates/_debate.html.erb
index 6080bfbcc..1300b3c11 100644
--- a/app/views/debates/_debate.html.erb
+++ b/app/views/debates/_debate.html.erb
@@ -1,17 +1,17 @@
-
Debate
-
+
<%= t("debates.debate.debate") %>
+
<%= link_to debate.title, debate %>
Por <%= debate.author.name %> el <%= l debate.created_at.to_date %>
-
<%= debate.description %>
+
<%= debate.description %>
<%= render 'shared/tags', debate: debate %>
-
+
<%= link_to debate_votes_path(debate, value: 'yes'), :class => 'in-favor', method: "post" do %>
<%= percentage('likes', debate) %>
@@ -26,8 +26,8 @@
-
<%= debate.total_votes %> votos
+
<%= pluralize(debate.total_votes, t("debates.debate.vote"), t("debates.debate.votes")) %>
-
\ No newline at end of file
+
diff --git a/app/views/debates/_form.html.erb b/app/views/debates/_form.html.erb
index df43ab8b0..cc4101c90 100644
--- a/app/views/debates/_form.html.erb
+++ b/app/views/debates/_form.html.erb
@@ -1,7 +1,7 @@
<%= form_for(@debate) do |f| %>
<% if @debate.errors.any? %>
-
<%= pluralize(@debate.errors.count, "error") %> prohibited this debate from being saved:
+
<%= pluralize(@debate.errors.count, t("debates.form.one_error"), t("debates.form.multiple_errors")) %> <%= t("debates.form.not_saved") %>:
<% @debate.errors.full_messages.each do |message| %>
@@ -11,23 +11,23 @@
<% end %>
- Título del debate
- Sé claro y conciso a la hora de poner un título, pero recuerda que debe explicar bien tu idea, ¡es tu carta de entrada!
+ <%= t("debates.form.debate_title") %>
+ <%= t("debates.form.title_instructions") %>
<%= f.text_field :title %>
- Describe tu opinión
- Explica con todo el detalle que puedas y de una manera sencilla la idea y que crees que conseguiríamos con ella
+ <%= t("debates.form.debate_text") %>
+ <%= t("debates.form.text_instructions") %>
<%= f.text_area :description %>
- <%= f.label :tag_list, "Temas (separados por comas)" %>
+ <%= f.label :tag_list, t("debates.form.tags_label") %>
<%= f.text_field :tag_list, value: @debate.tag_list.to_s %>
<% if @debate.new_record? %>
<%= f.check_box :terms_of_service %>
- Acepto la política de privacidad y el aviso legal
+ <%= t("debates.form.accept_terms") %>
<% end %>
<%= render 'shared/captcha' %>
diff --git a/app/views/debates/edit.html.erb b/app/views/debates/edit.html.erb
index da5449f23..dc90707b2 100644
--- a/app/views/debates/edit.html.erb
+++ b/app/views/debates/edit.html.erb
@@ -1,6 +1,6 @@
-Editing Debate
+<%= t("debates.edit.editing") %>
<%= render 'form' %>
-<%= link_to 'Show', @debate %> |
-<%= link_to 'Back', debates_path %>
+<%= link_to t("debates.edit.show_link"), @debate %> |
+<%= link_to t("debates.edit.back_link"), debates_path %>
diff --git a/app/views/debates/new.html.erb b/app/views/debates/new.html.erb
index c56fdb48f..55ae3876f 100644
--- a/app/views/debates/new.html.erb
+++ b/app/views/debates/new.html.erb
@@ -1,5 +1,5 @@
-Publicar un debate nuevo
+<%= t("debates.new.publish_new") %>
-<%= render 'form' %>
+<%= render "form" %>
-<%= link_to 'Back', debates_path %>
+<%= link_to t("debates.new.back_link"), debates_path %>
diff --git a/app/views/debates/show.html.erb b/app/views/debates/show.html.erb
index 6baa8c794..04d1e5354 100644
--- a/app/views/debates/show.html.erb
+++ b/app/views/debates/show.html.erb
@@ -1,6 +1,6 @@
- <%= link_to 'Volver', debates_path, :class => 'right' %>
+ <%= link_to t("debates.show.back_link"), debates_path, :class => 'right' %>
@@ -30,22 +30,22 @@
-
<%= pluralize(@debate.total_votes, 'voto', 'votos') %> votos
+
<%= pluralize(@debate.total_votes, t("debates.debate.vote"), t("debates.debate.votes")) %>
<% if current_user && @debate.editable_by?(current_user) %>
- <%= link_to 'Edit', edit_debate_path(@debate), :class => 'button radius right' %>
+ <%= link_to t("debates.show.edit_debate_link"), edit_debate_path(@debate), :class => 'button radius right' %>
<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
new file mode 100644
index 000000000..79f0bb645
--- /dev/null
+++ b/config/locales/en.yml
@@ -0,0 +1,31 @@
+en:
+ debates:
+ debate:
+ debate: Debate
+ vote: vote
+ votes: votes
+ form:
+ one_error: error
+ plural_errors: errors
+ not_saved: "prohibited this debate from being saved:"
+ debate_title: Debate title
+ title_instructions: "SBe clear and precise with the title, but make it informative"
+ debate_text: Ellaborate your opinion
+ text_instructions: "Explain your opinion, go into details, tell us what's the purpose of your idea"
+ tags_label: "Topics (comma separated)"
+ accept_terms: I accept the privacy policy and the legal terms
+ show:
+ back_link: Back
+ comments: Comments
+ leave_comment: Write a comment
+ edit_debate_link: Edit
+ edit:
+ editing: Edit debate
+ show_link: Show debate
+ back_link: Back
+ new:
+ publish_new: Publish new debate
+ back_link: Back
+ votes:
+ notice_thanks: "Thanks for voting."
+ notice_already_registered: "Your vote is already registered."
\ No newline at end of file
diff --git a/config/locales/es.yml b/config/locales/es.yml
new file mode 100644
index 000000000..0243bc604
--- /dev/null
+++ b/config/locales/es.yml
@@ -0,0 +1,31 @@
+es:
+ debates:
+ debate:
+ debate: Debate
+ vote: voto
+ votes: votos
+ form:
+ one_error: error
+ plural_errors: errores
+ not_saved: "impidieron guardar el debate:"
+ debate_title: Título del debate
+ title_instructions: "Sé claro y conciso a la hora de poner un título, pero recuerda que debe explicar bien tu idea, ¡es tu carta de entrada!"
+ debate_text: Describe tu opinión
+ text_instructions: "Explica con todo el detalle que puedas y de una manera sencilla la idea y que crees que conseguiríamos con ella"
+ tags_label: "Temas (separados por comas)"
+ accept_terms: Acepto la política de privacidad y el aviso legal
+ show:
+ back_link: Volver
+ comments: Comentarios
+ leave_comment: Deja tu comentario
+ edit_debate_link: Editar
+ edit:
+ editing: Editar debate
+ show_link: Ver debate
+ back_link: Volver
+ new:
+ publish_new: Publicar debate nuevo
+ back_link: Volver
+ votes:
+ notice_thanks: "Gracias por votar."
+ notice_already_registered: "Tu voto ya ha sido registrado."
\ No newline at end of file
diff --git a/spec/features/debates_spec.rb b/spec/features/debates_spec.rb
index d2ac83705..bfaebdada 100644
--- a/spec/features/debates_spec.rb
+++ b/spec/features/debates_spec.rb
@@ -72,14 +72,14 @@ feature 'Debates' do
visit debate_path(debate)
click_link 'Edit'
- fill_in 'debate_title', with: 'Dimisión Rajoy'
- fill_in 'debate_description', with: 'Podríamos...'
+ fill_in 'debate_title', with: "Go home Rajoy"
+ fill_in 'debate_description', with: "Let's..."
- click_button 'Update Debate'
+ click_button "Update Debate"
- expect(page).to have_content 'Debate was successfully updated.'
- expect(page).to have_content 'Dimisión Rajoy'
- expect(page).to have_content 'Podríamos...'
+ expect(page).to have_content "Debate was successfully updated."
+ expect(page).to have_content "Go home Rajoy"
+ expect(page).to have_content "Let's..."
end
end
diff --git a/spec/features/votes_spec.rb b/spec/features/votes_spec.rb
index f5399c9b1..cec794376 100644
--- a/spec/features/votes_spec.rb
+++ b/spec/features/votes_spec.rb
@@ -17,33 +17,33 @@ feature 'Votes' do
visit debate_path(@debate)
- expect(page).to have_content "2 votos"
-
- within('#in_favor') do
- expect(page).to have_content "50%"
+ expect(page).to have_content "2 votes"
+
+ within('#in_favor') do
+ expect(page).to have_content "50%"
end
-
- within('#against') do
- expect(page).to have_content "50%"
+
+ within('#against') do
+ expect(page).to have_content "50%"
end
end
scenario 'Create' do
find('#in_favor a').click
- expect(page).to have_content "Gracias por votar"
+ expect(page).to have_content "Thanks for voting."
end
scenario 'Update' do
find('#in_favor a').click
find('#against a').click
- expect(page).to have_content "Gracias por votar"
+ expect(page).to have_content "Thanks for voting."
end
scenario 'Trying to vote multiple times' do
find('#in_favor a').click
find('#in_favor a').click
- expect(page).to have_content "Tu voto ya ha sido registrado"
- expect(page).to have_content "1 voto"
+ expect(page).to have_content "Your vote is already registered."
+ expect(page).to have_content "1 vote"
end
end
\ No newline at end of file
Comentarios
+<%= t("debates.show.comments") %>