Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added zh-cn locale #3990

Merged
merged 5 commits into from
Nov 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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