LoginSignup
8
9

More than 5 years have passed since last update.

Railsでの日本語対応(i18n日本語辞書データ)

Last updated at Posted at 2015-02-22

Railsでの日本語対応。

i18nの設定で対応という事で一般的な記載。

config/application.rb
module AppName
  class Application < Rails::Application
    config.i18n.default_locale = :ja
  end
end

一般的にi18nで日本語対応しているだけです。

で、「パーフェクト Ruby on Rails」にあったやり方。
汎用的なエラーメッセージ用の辞書データはrails-i18nのリポジトリにまとめられているようなので、辞書データを保存。

$ curl -o config/locales/ja.yml -L https://raw.githubusercontent.com/svenfuchs/rails-i18n/master/rails/locale/ja.yml

確かに汎用辞書適用は便利かも。

★Railsの多言語化対応 I18nのやり方を整理してみた!【国際化/英語化】
http://morizyun.github.io/blog/i18n-english-rails-ruby-many-languages/

※追記
Gemを使ってのインストールが便利そうです。
http://easyramble.com/i18n-with-i18n-generators.html

8
9
1

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
8
9