about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/models/account.rb2
-rw-r--r--app/models/status.rb2
-rw-r--r--config/activerecord.en.yml12
-rw-r--r--config/activerecord.ja.yml12
4 files changed, 26 insertions, 2 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index 9b4f7e2ca..b497a90a3 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -8,7 +8,7 @@ class Account < ApplicationRecord
 
   # Local users
   has_one :user, inverse_of: :account
-  validates :username, presence: true, format: { with: /\A[a-z0-9_]+\z/i, message: 'only letters, numbers and underscores' }, uniqueness: { scope: :domain, case_sensitive: false }, length: { maximum: 30 }, if: 'local?'
+  validates :username, presence: true, format: { with: /\A[a-z0-9_]+\z/i }, uniqueness: { scope: :domain, case_sensitive: false }, length: { maximum: 30 }, if: 'local?'
   validates :username, presence: true, uniqueness: { scope: :domain, case_sensitive: true }, unless: 'local?'
 
   # Avatar upload
diff --git a/app/models/status.rb b/app/models/status.rb
index 2d27a57d5..b75bd0a7b 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -29,7 +29,7 @@ class Status < ApplicationRecord
   validates :uri, uniqueness: true, unless: 'local?'
   validates :text, presence: true, unless: 'reblog?'
   validates_with StatusLengthValidator
-  validates :reblog, uniqueness: { scope: :account, message: 'of status already exists' }, if: 'reblog?'
+  validates :reblog, uniqueness: { scope: :account }, if: 'reblog?'
 
   default_scope { order('id desc') }
 
diff --git a/config/activerecord.en.yml b/config/activerecord.en.yml
new file mode 100644
index 000000000..c3354fa25
--- /dev/null
+++ b/config/activerecord.en.yml
@@ -0,0 +1,12 @@
+en:
+  activerecord:
+    errors:
+      models:
+        account:
+          attributes:
+            username:
+              invalid: only letters, numbers and underscores
+        status:
+          attributes:
+            reblog:
+              taken: of status already exists
diff --git a/config/activerecord.ja.yml b/config/activerecord.ja.yml
new file mode 100644
index 000000000..6e6b48496
--- /dev/null
+++ b/config/activerecord.ja.yml
@@ -0,0 +1,12 @@
+ja:
+  activerecord:
+    errors:
+      models:
+        account:
+          attributes:
+            username:
+              invalid: アルファベット・数値・アンダーバー(_)で入力してください
+        status:
+          attributes:
+            reblog:
+              taken: のブーストはすでに存在します