LoginSignup
5
5

More than 5 years have passed since last update.

RailsのI18nで読み込まれているYAMLファイルをすべて調べるには

Posted at

consoleからI18n.load_pathとすればよい。外部のgem経由で読み込まれているファイルも含めて、arrayで返ってくる。

[1] pry(main)> I18n.load_path
=> ["/Users/foo/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-3.2.8/lib/active_support/locale/en.yml",
 "/Users/foo/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activemodel-3.2.8/lib/active_model/locale/en.yml",
 "/Users/foo/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.2.8/lib/active_record/locale/en.yml",
 "/Users/foo/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/actionpack-3.2.8/lib/action_view/locale/en.yml",
...

上記ログにある、Railsの本体関連のgem経由で読み込まれてる奴のソースは以下。

Rails GuidesのRails Internationalization (I18n) API
も参照。

5
5
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
5
5