railsの初学者です。複数モデルの日本語化ができずに困っています。
以前は
config/locales/users/ja.yml
yml
1ja: 2 activerecord: 3 models: 4 user: 5 attributes: 6 user: 7 name: ニックネーム 8 email: メールアドレス 9 password: パスワード 10 password_confirmation: パスワード確認 11 remember_me: 入力情報を記憶する 12 created_at: 作成日時 13 updated_at: 更新日時
このようにしていて、userモデルでうまく動いていたのですが、申し込みモデルも追加したかったので、ここを参考にしてやってみたところteratail
config/locale/models/ja.yml
yml
1ja: 2 activerecord: 3 models: 4 user: 5 attributes: 6 user: 7 name: ニックネーム 8 email: メールアドレス 9 password: パスワード 10 password_confirmation: パスワード確認 11 remember_me: 入力情報を記憶する 12 created_at: 作成日時 13 updated_at: 更新日時 14 application: 15 last_name: 姓 16 first_name: 名 17 email: メールアドレス 18 postal_code: 郵便番号 19 prefecture: 都道府県 20 firrst_address: 住所1 21 second_address: 住所2 22 created_at: 作成日時 23 updated_at: 更新日時
これではうまく反映されませんでした。config以下のusersディレクトリを消したらまずかったのでしょうか? 理由のわかる方どうかご教授ください。
関連ファイル
config/application.rb
rb
1require_relative 'boot' 2 3require 'rails/all' 4 5# Require the gems listed in Gemfile, including any gems 6# you've limited to :test, :development, or :production. 7Bundler.require(*Rails.groups) 8 9module SimAgent2 10 class Application < Rails::Application 11 # Initialize configuration defaults for originally generated Rails version. 12 config.time_zone = 'Tokyo' 13 config.load_defaults 5.1 14 config.i18n.default_locale = :ja 15 config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.rb,yml').to_s] 16 # Settings in config/environments/* take precedence over those specified here. 17 # Application configuration should go into files in config/initializers 18 # -- all .rb files in that directory are automatically loaded. 19 end 20end 21
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。