teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

説明不足

2019/06/25 01:06

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -12,14 +12,31 @@
12
12
  きっと「ja.yml」の書き方の知識がほとんどないせいだと思いますが、
13
13
  調べても調べても正解を導き出せません。
14
14
 
15
+ config/application.rb↓
16
+
15
17
  ```ここに言語を入力
16
- # config/application.rb
18
+ require_relative 'boot'
17
19
 
20
+ require 'rails/all'
21
+
22
+ # Require the gems listed in Gemfile, including any gems
23
+ # you've limited to :test, :development, or :production.
24
+ Bundler.require(*Rails.groups)
25
+
18
- module YourAppName
26
+ module Myapp
19
27
  class Application < Rails::Application
28
+ # Initialize configuration defaults for originally generated Rails version.
29
+ config.load_defaults 5.2
20
30
  config.i18n.default_locale = :ja
31
+ config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.yml').to_s]
32
+
33
+ # Settings in config/environments/* take precedence over those specified here.
34
+ # Application configuration can go into files in config/initializers
35
+ # -- all .rb files in that directory are automatically loaded after loading
36
+ # the framework and any gems in your application.
21
37
  end
22
38
  end
39
+
23
40
  ```
24
41
 
25
42
  posts/new.html.erb↓

1

説明を足した。

2019/06/25 01:05

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -12,8 +12,19 @@
12
12
  きっと「ja.yml」の書き方の知識がほとんどないせいだと思いますが、
13
13
  調べても調べても正解を導き出せません。
14
14
 
15
- posts/new.html.erb
16
15
  ```ここに言語を入力
16
+ # config/application.rb
17
+
18
+ module YourAppName
19
+ class Application < Rails::Application
20
+ config.i18n.default_locale = :ja
21
+ end
22
+ end
23
+ ```
24
+
25
+ posts/new.html.erb↓
26
+ ```ここに言語を入力
27
+
17
28
  <%= form_tag("/posts/create", {multipart: true}) do %>
18
29
  <% if @post.errors.any? %>
19
30
  <strong style="color:red">入力内容にエラーがあります</strong>
@@ -48,7 +59,7 @@
48
59
  <% end %>
49
60
  ```
50
61
 
51
- ja.yml
62
+ ja.yml
52
63
  ```ここに言語を入力
53
64
  ja:
54
65
  activerecord: