我正在研究如何将 rails-i18n 与 HAML一起使用,以了解 i18n 如何与 haml 一起工作,但遇到了一个我无法弄清楚的问题。
这有效:
en.yml
en:
sitename: "Happy Sunday"
新的.haml
%h1= t("sitename")
当我将 yml 更改为
en.yml
en:
home:
sitename: "Happy Sunday"
新的.haml
%h1= t("home.sitename")
然后我收到以下错误:
ArgumentError in Devise/sessions#new
Showing
..../devise/sessions/new.html.haml where line #20 raised:
syntax error on line 4, col 6: ` home:'
Extracted source (around line #20):
17: = flash[:alert]
18: .row
19: .headline.pagination-centered
20: %h1= t("home.sitename")
21: %h2= t("slogan")
22: .row.headline.pagination-centered
23: %a{:href => "/tour"}