2012-08-13 28 views
0

一個本地化陽明文件* .yml本地化的Ruby on Rails的:在* .yml文件嵌套值

errors: 
    template: 
     body:  "Body error message" 
     header: 
      one: "1 error " 
      other: "%{count} errores" 

出於某種原因,它拋出一個頁面"(/home/alex/RubymineProjects/psg/config/locales/es.yml): did not find expected key while parsing a block mapping at line 248 column 7",這意味着對錯誤有什麼不對的吧。

如果我刪除"Body error message"(只有值,而不是body鍵),那麼一切都很好,頁面上沒有錯誤。

出了什麼問題?如何定義body的鍵值及其嵌套值?

回答

1

你的縮進是錯誤的:bodyheader應該是在同一深度:

errors: 
    template: 
    body:  "Body error message" 
    header: 
     one: "1 error " 
     other: "%{count} errores"