mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-21 22:32:58 +00:00
Extract error messages to locale file (#2162)
This commit is contained in:
parent
f06cba3f60
commit
2c0d756ad9
|
@ -8,7 +8,7 @@ class Account < ApplicationRecord
|
||||||
|
|
||||||
# Local users
|
# Local users
|
||||||
has_one :user, inverse_of: :account
|
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?'
|
validates :username, presence: true, uniqueness: { scope: :domain, case_sensitive: true }, unless: 'local?'
|
||||||
|
|
||||||
# Avatar upload
|
# Avatar upload
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Status < ApplicationRecord
|
||||||
validates :uri, uniqueness: true, unless: 'local?'
|
validates :uri, uniqueness: true, unless: 'local?'
|
||||||
validates :text, presence: true, unless: 'reblog?'
|
validates :text, presence: true, unless: 'reblog?'
|
||||||
validates_with StatusLengthValidator
|
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') }
|
default_scope { order('id desc') }
|
||||||
|
|
||||||
|
|
12
config/activerecord.en.yml
Normal file
12
config/activerecord.en.yml
Normal file
|
@ -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
|
12
config/activerecord.ja.yml
Normal file
12
config/activerecord.ja.yml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
ja:
|
||||||
|
activerecord:
|
||||||
|
errors:
|
||||||
|
models:
|
||||||
|
account:
|
||||||
|
attributes:
|
||||||
|
username:
|
||||||
|
invalid: アルファベット・数値・アンダーバー(_)で入力してください
|
||||||
|
status:
|
||||||
|
attributes:
|
||||||
|
reblog:
|
||||||
|
taken: のブーストはすでに存在します
|
Loading…
Reference in a new issue