2012-01-21 4 views
0

メッセージを翻訳する必要があり、それを含むファイルが見つかりませんでしたか?私は 'Active Record error_messages_for Helper'の5.1.3翻訳をruby guideから試みましたが、動作しませんでした。レール3はデフォルトのエラーメッセージを保存しますか?

+1

変換する[方法の可能性のある重複デフォルトのエラーメッセージが表示されますか?](http://stackoverflow.com/questions/8950248/how-to-translate-default-error-messages-in-rails) –

+1

新しい質問を既存の質問と少し違った形で開始するのではなく他のものを編集し、必要に応じてさらに情報を追加するだけです。 –

答えて

2

config/locales /にen.yml(またはwhatever_locale.yml)が必要です。その場合、例を使用してください:

en: 
    activerecord: 
    errors: 
     template: 
     header: 
      one: "1 error prohibited this %{model} from being saved" 
      other: "%{count} errors prohibited this %{model} from being saved" 
     body: "There were problems with the following fields:" 

"en"をあなたのロケールで変更してください。ここで

はサンプルです:

fr: 
    activerecord: 
    errors: 
     format: "your message" 
    errors: 
     full_messages: "your message" 
    errors: 
     models: 
     full_messages: "your message" 
     TABLE_NAME_SINGULAR: 
      blank: 
       "\"%{attribute}\" is needed" 
      attributes: 
      ATTRIBUTE: 
       blank: 
       "Message" 
       taken: 
       "Message" 

あなたは「設定/ロケール」に新しいファイルを作成した場合、私はあなたがRailsのサーバを再起動する必要はありだと思う...

+0

はい、再起動する必要があります。 – mrmnmly

関連する問題