2012-01-21 90 views
0

我需要翻譯郵件,但找不到包含它們的文件?我試過'5.1.3爲活動記錄error_messages_for Helper'翻譯從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

是的,它需要重新啓動rails服務器 – mrmnmly