From fa6bbe5c4a3aef106752ed83dc2efdc89216850c Mon Sep 17 00:00:00 2001 From: Jeffrey Warren Date: Fri, 16 Nov 2018 08:53:15 -0500 Subject: [PATCH] added zh-cn locale (#3990) * added zh-cn locale * change zh-cn to zh-CN * additional tweaks to quiz * emoji in prompt * size --- app/views/users/_form.html.erb | 44 ++----------------- app/views/users/_spamaway.html.erb | 41 +++++++++++++++++ config/application.rb | 2 +- .../models/spamaway/{zh-cn.yml => zh-CN.yml} | 0 config/locales/views/users/_form/en.yml | 2 +- .../users/_form/{zh-cn.yml => zh-CN.yml} | 2 +- 6 files changed, 47 insertions(+), 44 deletions(-) create mode 100644 app/views/users/_spamaway.html.erb rename config/locales/models/spamaway/{zh-cn.yml => zh-CN.yml} (100%) rename config/locales/views/users/_form/{zh-cn.yml => zh-CN.yml} (92%) diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb index 67e12d712d..c05db4e46f 100644 --- a/app/views/users/_form.html.erb +++ b/app/views/users/_form.html.erb @@ -1,3 +1,4 @@ +
<%= form_for @user, :url => {:controller => 'users', :action => @action}, :html => {:class => "row"} do |f| %> <% if f.error_messages != "" %>
<%= f.error_messages %>
<% end %> @@ -90,47 +91,7 @@ <% else %> - <%= fields_for @spamaway do |spam| %> - -
- - -

- <%= t('users._form.spam_filtering') %> -

- - <% vars = [:statement1, :statement2, :statement3, :statement4] %> - <% turingtest = Spamaway.get_pairs vars.length %> - <% turingtest.each_index do |i| %> - -
- <% [0,1].each_with_index do |s, j| %><% statement = turingtest[i][s] %> -
- -
- <% end %> -
-
- - <% end %> - -
- -
- - <%= spam.text_area :follow_instructions, { class: "form-control col-md-6", - rows: 8, - tabindex: 7, - placeholder: I18n.t('users._form.dont_write_here') } - %> - -
- - <% end %> + <%= render partial: 'spamaway', locals: { spamaway: @spamaway } %> <% end %> @@ -177,3 +138,4 @@
<% end %> + diff --git a/app/views/users/_spamaway.html.erb b/app/views/users/_spamaway.html.erb new file mode 100644 index 0000000000..f49c239bbb --- /dev/null +++ b/app/views/users/_spamaway.html.erb @@ -0,0 +1,41 @@ +<%= fields_for @spamaway do |spam| %> + +
+ + +

+ <%= t('users._form.spam_filtering') %> +

+ + <% vars = [:statement1, :statement2, :statement3, :statement4] %> + <% turingtest = Spamaway.get_pairs vars.length %> + <% turingtest.each_index do |i| %> + +
+ <% [0,1].each_with_index do |s, j| %><% statement = turingtest[i][s] %> +
+ +
+ <% end %> +
+
+ + <% end %> + +
+ +
+ + <%= spam.text_area :follow_instructions, { class: "form-control col-md-6", + rows: 8, + tabindex: 7, + placeholder: I18n.t('users._form.dont_write_here') } + %> + +
+ +<% end %> diff --git a/config/application.rb b/config/application.rb index e782266acc..07551e61f9 100644 --- a/config/application.rb +++ b/config/application.rb @@ -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}')] diff --git a/config/locales/models/spamaway/zh-cn.yml b/config/locales/models/spamaway/zh-CN.yml similarity index 100% rename from config/locales/models/spamaway/zh-cn.yml rename to config/locales/models/spamaway/zh-CN.yml diff --git a/config/locales/views/users/_form/en.yml b/config/locales/views/users/_form/en.yml index 41f01cf06d..feda8aa8d2 100644 --- a/config/locales/views/users/_form/en.yml +++ b/config/locales/views/users/_form/en.yml @@ -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" diff --git a/config/locales/views/users/_form/zh-cn.yml b/config/locales/views/users/_form/zh-CN.yml similarity index 92% rename from config/locales/views/users/_form/zh-cn.yml rename to config/locales/views/users/_form/zh-CN.yml index c4654fb7c5..5616b20707 100644 --- a/config/locales/views/users/_form/zh-cn.yml +++ b/config/locales/views/users/_form/zh-CN.yml @@ -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"