From c4d36d024c3fa581050dbc79ff772f44b16038ad Mon Sep 17 00:00:00 2001 From: SerCom_KC Date: Sun, 7 Jan 2018 16:32:50 +0800 Subject: [PATCH 1/3] Update Simplified Chinese translations (#6215) * i18n: (zh-CN) Add translations of #6125 * i18n: (zh-CN) Add translations of #6132 * i18n: (zh-CN) Add translations of #6099 * i18n: (zh-CN) Add translations of #6071 * i18n: (zh-CN) Improve translations --- app/javascript/mastodon/locales/zh-CN.json | 6 +++--- app/views/user_mailer/email_changed.zh-cn.html.erb | 13 +++++++++++++ app/views/user_mailer/email_changed.zh-cn.text.erb | 11 +++++++++++ .../reconfirmation_instructions.zh-cn.html.erb | 13 +++++++++++++ .../reconfirmation_instructions.zh-cn.text.erb | 10 ++++++++++ config/locales/devise.zh-CN.yml | 12 +++++++----- config/locales/zh-CN.yml | 6 ++++++ 7 files changed, 63 insertions(+), 8 deletions(-) create mode 100644 app/views/user_mailer/email_changed.zh-cn.html.erb create mode 100644 app/views/user_mailer/email_changed.zh-cn.text.erb create mode 100644 app/views/user_mailer/reconfirmation_instructions.zh-cn.html.erb create mode 100644 app/views/user_mailer/reconfirmation_instructions.zh-cn.text.erb diff --git a/app/javascript/mastodon/locales/zh-CN.json b/app/javascript/mastodon/locales/zh-CN.json index ce16dcd8e..ef850256c 100644 --- a/app/javascript/mastodon/locales/zh-CN.json +++ b/app/javascript/mastodon/locales/zh-CN.json @@ -50,7 +50,7 @@ "column_header.unpin": "取消固定", "column_subheading.navigation": "导航", "column_subheading.settings": "设置", - "compose_form.hashtag_warning": "This toot won't be listed under any hashtag as it is unlisted. Only public toots can be searched by hashtag.", + "compose_form.hashtag_warning": "这条嘟文被设置为“不公开”,因此它不会出现在任何话题标签的列表下。只有公开的嘟文才能通过话题标签进行搜索。", "compose_form.lock_disclaimer": "你的帐户没有{locked}。任何人都可以在关注你后立即查看仅关注者可见的嘟文。", "compose_form.lock_disclaimer.lock": "开启保护", "compose_form.placeholder": "在想啥?", @@ -214,7 +214,7 @@ "search_popout.tips.user": "用户", "search_results.total": "共 {count, number} 个结果", "standalone.public_title": "大家都在干啥?", - "status.block": "Block @{name}", + "status.block": "屏蔽 @{name}", "status.cannot_reblog": "无法转嘟这条嘟文", "status.delete": "删除", "status.embed": "嵌入", @@ -223,7 +223,7 @@ "status.media_hidden": "隐藏媒体内容", "status.mention": "提及 @{name}", "status.more": "更多", - "status.mute": "Mute @{name}", + "status.mute": "隐藏 @{name}", "status.mute_conversation": "隐藏此对话", "status.open": "展开嘟文", "status.pin": "在个人资料页面置顶", diff --git a/app/views/user_mailer/email_changed.zh-cn.html.erb b/app/views/user_mailer/email_changed.zh-cn.html.erb new file mode 100644 index 000000000..74b1b6150 --- /dev/null +++ b/app/views/user_mailer/email_changed.zh-cn.html.erb @@ -0,0 +1,13 @@ +

<%= @resource.email %>,你好呀!

+ +<% if @resource&.unconfirmed_email? %> +

我们发送这封邮件是为了提醒你,你在 <%= @instance %> 上使用的电子邮件地址即将变更为 <%= @resource.unconfirmed_email %>。

+<% else %> +

我们发送这封邮件是为了提醒你,你在 <%= @instance %> 上使用的电子邮件地址已经变更为 <%= @resource.unconfirmed_email %>。

+<% end %> + +

+ 如果你并没有请求更改你的电子邮件地址,则他人很有可能已经入侵你的帐户。请立即更改你的密码;如果你已经无法访问你的帐户,请联系实例的管理员请求协助。 +

+ +

来自 <%= @instance %> 管理团队

diff --git a/app/views/user_mailer/email_changed.zh-cn.text.erb b/app/views/user_mailer/email_changed.zh-cn.text.erb new file mode 100644 index 000000000..d59ac58c4 --- /dev/null +++ b/app/views/user_mailer/email_changed.zh-cn.text.erb @@ -0,0 +1,11 @@ +<%= @resource.email %>,你好呀! + +<% if @resource&.unconfirmed_email? %> +我们发送这封邮件是为了提醒你,你在 <%= @instance %> 上使用的电子邮件地址即将变更为 <%= @resource.unconfirmed_email %>。 +<% else %> +我们发送这封邮件是为了提醒你,你在 <%= @instance %> 上使用的电子邮件地址已经变更为 <%= @resource.unconfirmed_email %>。 +<% end %> + +如果你并没有请求更改你的电子邮件地址,则他人很有可能已经入侵你的帐户。请立即更改你的密码;如果你已经无法访问你的帐户,请联系实例的管理员请求协助。 + +来自 <%= @instance %> 管理团队 diff --git a/app/views/user_mailer/reconfirmation_instructions.zh-cn.html.erb b/app/views/user_mailer/reconfirmation_instructions.zh-cn.html.erb new file mode 100644 index 000000000..7b79a490e --- /dev/null +++ b/app/views/user_mailer/reconfirmation_instructions.zh-cn.html.erb @@ -0,0 +1,13 @@ +

<%= @resource.email %>,你好呀!

+ +

你正在更改你在 <%= @instance %> 使用的电子邮件地址。

+ +

点击下面的链接以确认操作:
+<%= link_to '确认我的电子邮件地址', confirmation_url(@resource, confirmation_token: @token) %>

+ +

上面的链接按不动?把下面的链接复制到地址栏再试试:
+<%= confirmation_url(@resource, confirmation_token: @token) %> + +

记得读一读我们的<%= link_to '使用条款', terms_url %>哦。

+ +

来自 <%= @instance %> 管理团队

diff --git a/app/views/user_mailer/reconfirmation_instructions.zh-cn.text.erb b/app/views/user_mailer/reconfirmation_instructions.zh-cn.text.erb new file mode 100644 index 000000000..977d78137 --- /dev/null +++ b/app/views/user_mailer/reconfirmation_instructions.zh-cn.text.erb @@ -0,0 +1,10 @@ +<%= @resource.email %>,你好呀! + +你正在更改你在 <%= @instance %> 使用的电子邮件地址。 + +点击下面的链接以确认操作: +<%= confirmation_url(@resource, confirmation_token: @token) %> + +记得读一读我们的使用条款哦:<%= terms_url %> + +来自 <%= @instance %> 管理团队 diff --git a/config/locales/devise.zh-CN.yml b/config/locales/devise.zh-CN.yml index 5560e12b3..0bd855137 100644 --- a/config/locales/devise.zh-CN.yml +++ b/config/locales/devise.zh-CN.yml @@ -17,15 +17,17 @@ zh-CN: unconfirmed: 继续操作前请先确认你的帐户。 mailer: confirmation_instructions: - subject: Mastodon 帐户确认信息 + subject: Mastodon:确认 %{instance} 帐户信息 email_changed: - subject: Mastodon 电子邮件地址已被修改 + subject: Mastodon:电子邮件地址已被修改 password_change: - subject: Mastodon 密码已被重置 + subject: Mastodon:密码已被重置 + reconfirmation_instructions: + subject: Mastodon:确认 %{instance} 电子邮件地址 reset_password_instructions: - subject: Mastodon 重置密码信息 + subject: Mastodon:重置密码信息 unlock_instructions: - subject: Mastodon 帐户解锁信息 + subject: Mastodon:帐户解锁信息 omniauth_callbacks: failure: 由于%{reason},无法从%{kind}获得授权。 success: 成功地从%{kind}获得授权。 diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index e1909ac71..bb9f45e93 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -263,12 +263,18 @@ zh-CN: unresolved: 未处理 view: 查看 settings: + activity_api_enabled: + desc_html: 本站用户发布的嘟文数,以及本站的活跃用户数和一周内新用户数 + title: 公开用户活跃度的统计数据 bootstrap_timeline_accounts: desc_html: 用半角逗号分隔多个用户名。只能添加来自本站且未开启保护的帐户。如果留空,则默认关注本站所有的管理员。 title: 新用户默认关注 contact_information: email: 用于联系的公开电子邮件地址 username: 用于联系的公开用户名 + peers_api_enabled: + desc_html: 截至目前本实例在网络中已发现的域名 + title: 公开已知实例的列表 registrations: closed_message: desc_html: 本站关闭注册期间的提示信息。可以使用 HTML 标签 From da809f9eec45cdac0fa31ba89df91cd4ce4a5398 Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Sun, 7 Jan 2018 23:12:59 +0900 Subject: [PATCH 2/3] Fix unintended cache (#6214) --- app/controllers/application_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f59f2725b..dae1804c2 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -124,15 +124,15 @@ class ApplicationController < ActionController::Base def render_cached_json(cache_key, **options) options[:expires_in] ||= 3.minutes - options[:public] ||= true cache_key = cache_key.join(':') if cache_key.is_a?(Enumerable) + cache_public = options.key?(:public) ? options.delete(:public) : true content_type = options.delete(:content_type) || 'application/json' data = Rails.cache.fetch(cache_key, { raw: true }.merge(options)) do yield.to_json end - expires_in options[:expires_in], public: options[:public] + expires_in options[:expires_in], public: cache_public render json: data, content_type: content_type end From 1d92b90be9f494d90a6f79f53be9cca68562867e Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Sun, 7 Jan 2018 23:19:23 +0900 Subject: [PATCH 3/3] Fix force_ssl conditional (#6201) --- app/controllers/application_controller.rb | 2 +- .../application_controller_spec.rb | 20 ++++++++----------- spec/rails_helper.rb | 2 +- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index dae1804c2..e1aae0b67 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -30,7 +30,7 @@ class ApplicationController < ActionController::Base private def https_enabled? - Rails.env.production? && ENV['LOCAL_HTTPS'] == 'true' + Rails.env.production? end def store_current_location diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index 6a54a78c5..51c0e3c70 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -47,22 +47,18 @@ describe ApplicationController, type: :controller do include_examples 'respond_with_error', 422 end - it "does not force ssl if LOCAL_HTTPS is not 'true'" do + it "does not force ssl if Rails.env.production? is not 'true'" do routes.draw { get 'success' => 'anonymous#success' } - ClimateControl.modify LOCAL_HTTPS: '' do - allow(Rails.env).to receive(:production?).and_return(true) - get 'success' - expect(response).to have_http_status(:success) - end + allow(Rails.env).to receive(:production?).and_return(false) + get 'success' + expect(response).to have_http_status(:success) end - it "forces ssl if LOCAL_HTTPS is 'true'" do + it "forces ssl if Rails.env.production? is 'true'" do routes.draw { get 'success' => 'anonymous#success' } - ClimateControl.modify LOCAL_HTTPS: 'true' do - allow(Rails.env).to receive(:production?).and_return(true) - get 'success' - expect(response).to redirect_to('https://test.host/success') - end + allow(Rails.env).to receive(:production?).and_return(true) + get 'success' + expect(response).to redirect_to('https://test.host/success') end describe 'helper_method :current_account' do diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 67c6b9205..4f7399505 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -46,7 +46,7 @@ RSpec.configure do |config| config.include ActiveSupport::Testing::TimeHelpers config.before :each, type: :feature do - https = Rails.env.production? || ENV['LOCAL_HTTPS'] == 'true' + https = ENV['LOCAL_HTTPS'] == 'true' Capybara.app_host = "http#{https ? 's' : ''}://#{ENV.fetch('LOCAL_DOMAIN')}" end