about summary refs log tree commit diff
diff options
context:
space:
mode:
authoralpaca-tc <alpaca-tc@alpaca.tc>2017-05-04 06:36:19 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-05-03 23:36:19 +0200
commitdb92eec876efc2d5b450b0c9c70d78091762fc4b (patch)
tree844bcf249375554b609b76ab4fef14016a9cc60a
parent44969307c71bbd9caf21890b02a525910d1cf017 (diff)
Localize 'throttled' (#2755)
-rw-r--r--config/i18n-tasks.yml1
-rw-r--r--config/initializers/rack_attack.rb2
-rw-r--r--config/locales/en.yml1
-rw-r--r--config/locales/ja.yml1
4 files changed, 4 insertions, 1 deletions
diff --git a/config/i18n-tasks.yml b/config/i18n-tasks.yml
index 853d148b2..20c134249 100644
--- a/config/i18n-tasks.yml
+++ b/config/i18n-tasks.yml
@@ -54,3 +54,4 @@ ignore_unused:
   - 'simple_form.{error_notification,required}.:'
   - 'errors.messages.*'
   - 'activerecord.errors.models.doorkeeper/*'
+  - 'errors.429'
diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb
index 3ebe39462..d5cd77b34 100644
--- a/config/initializers/rack_attack.rb
+++ b/config/initializers/rack_attack.rb
@@ -38,6 +38,6 @@ class Rack::Attack
       'X-RateLimit-Reset'     => (now + (match_data[:period] - now.to_i % match_data[:period])).iso8601(6),
     }
 
-    [429, headers, [{ error: 'Throttled' }.to_json]]
+    [429, headers, [{ error: I18n.t('errors.429') }.to_json]]
   end
 end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 26ecac7bc..936aa38d9 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -223,6 +223,7 @@ en:
     '422':
       content: Security verification failed. Are you blocking cookies?
       title: Security verification failed
+    '429': Throttled
   exports:
     blocks: You block
     csv: CSV
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
index cc79ca5a8..af5e77d14 100644
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -222,6 +222,7 @@ ja:
     '422':
       content: セキュリティ認証に失敗しました。Cookieをブロックしていませんか?
       title: セキュリティ認証に失敗
+    '429': リクエストの制限に達しました。
   exports:
     blocks: ブロック
     csv: CSV