Skip to content

Commit

Permalink
added zh-cn locale (#3990)
Browse files Browse the repository at this point in the history
* added zh-cn locale

* change zh-cn to zh-CN

* additional tweaks to quiz

* emoji in prompt

* size
  • Loading branch information
jywarren authored Nov 16, 2018
1 parent c686337 commit fa6bbe5
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 44 deletions.
44 changes: 3 additions & 41 deletions app/views/users/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<div style="padding:10px;">
<%= form_for @user, :url => {:controller => 'users', :action => @action}, :html => {:class => "row"} do |f| %>

<% if f.error_messages != "" %><div class="alert alert-danger"><%= f.error_messages %></div><% end %>
Expand Down Expand Up @@ -90,47 +91,7 @@

<% else %>

<%= fields_for @spamaway do |spam| %>

<div class="form-group spamaway">

<label for="spamaway_follow_instructions">
<%= t('users._form.are_you_human') %>
</label>
<p>
<%= t('users._form.spam_filtering') %>
</p>

<% vars = [:statement1, :statement2, :statement3, :statement4] %>
<% turingtest = Spamaway.get_pairs vars.length %>
<% turingtest.each_index do |i| %>

<div class="btn-group btn-group-justified" role="group">
<% [0,1].each_with_index do |s, j| %><% statement = turingtest[i][s] %>
<div class="btn-group" role="group">
<button type="button" class="col-xs-5 btn btn-default" style="text-align:left;<% if i.odd? %> background:#eef;<% end %>" id="spamaway-<%= i.to_s + j.to_s %>">
<%= spam.radio_button vars[i], statement %> <%= statement %>
</button>
</div>
<% end %>
</div>
<br />

<% end %>

</div>

<div class="form-group">

<%= spam.text_area :follow_instructions, { class: "form-control col-md-6",
rows: 8,
tabindex: 7,
placeholder: I18n.t('users._form.dont_write_here') }
%>

</div>

<% end %>
<%= render partial: 'spamaway', locals: { spamaway: @spamaway } %>

<% end %>

Expand Down Expand Up @@ -177,3 +138,4 @@
</div>

<% end %>
</div>
41 changes: 41 additions & 0 deletions app/views/users/_spamaway.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<%= fields_for @spamaway do |spam| %>

<div class="form-group spamaway">

<label for="spamaway_follow_instructions">
<%= t('users._form.are_you_human') %>
</label>
<p style="font-size: 1.3em;">
<%= t('users._form.spam_filtering') %>
</p>

<% vars = [:statement1, :statement2, :statement3, :statement4] %>
<% turingtest = Spamaway.get_pairs vars.length %>
<% turingtest.each_index do |i| %>

<div class="btn-group btn-group-justified" role="group">
<% [0,1].each_with_index do |s, j| %><% statement = turingtest[i][s] %>
<div class="btn-group" role="group">
<button type="button" class="col-xs-5 btn btn-default" style="font-size:3em;text-align:left;<% if i.odd? %> background:#eef;<% end %>" id="spamaway-<%= i.to_s + j.to_s %>">
<%= spam.radio_button vars[i], statement %> <%= statement %>
</button>
</div>
<% end %>
</div>
<br />

<% end %>

</div>

<div class="form-group hide">

<%= spam.text_area :follow_instructions, { class: "form-control col-md-6",
rows: 8,
tabindex: 7,
placeholder: I18n.t('users._form.dont_write_here') }
%>

</div>

<% end %>
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Application < Rails::Application
# Enable the asset pipeline
config.assets.enabled = true

I18n.available_locales = [:en, :de]
I18n.available_locales = [:en, :de, "zh-CN"]
config.i18n.default_locale = :en

config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion config/locales/views/users/_form/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ en:
bio: "Bio"
add_bio: "Add a short bio to appear on your profile page"
are_you_human: "Are you human?"
spam_filtering: "Sorry: spam filtering! Please select the animals below to show that you're a real person."
spam_filtering: "Sorry: spam filtering! Please select the animals - 🦁 - below to show that you're a real person."
dont_write_here: "Don't write anything here if you're a real person."
sign_up: "Sign up"
log_in: "Log in"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ zh-cn:
bio: "Bio"
add_bio: "Add a short bio to appear on your profile page"
are_you_human: "Are you human?"
spam_filtering: "抱歉:垃圾邮件过滤! 请选择下面的动物,以表明你是一个真实的人。"
spam_filtering: "抱歉:垃圾邮件过滤! 请选择下面的动物,以表明你是一个真实的人。🦁"
dont_write_here: "如果你是一个真人,不要在这里写任何东西。"
sign_up: "Sign up"
log_in: "Log in"
Expand Down

0 comments on commit fa6bbe5

Please sign in to comment.