0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

defaults.message

Posted at

自分用です!

ja.ymlのdefaults.messageに定義したものを呼び出します。

ja:
  defaults:
    login: 'ログイン'
    register: '登録'
    logout: 'ログアウト'
    create: '登録する'
    message:
      require_login: 'ログインしてください'
      created: "%{item}を作成しました"
      not_created: "%{item}を作成できませんでした"
ja:
  activerecord:
    models:
      user: 'ユーザー'
      board: '掲示板'

t('defaults.message.created', item: Board.model_name.human)

modelのboardから引っ張るには、Board.model_name.humanとかく。

itemという変数を定義することによって、itemの中身を変えるだけで使いまわせる。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?