我正在调查How to use rails-i18n with HAML以了解i18n如何与haml一起工作,但遇到了一个我无法弄清楚的问题。
这有效:
en.yml
en:
sitename: "Happy Sunday"
new.haml
%h1= t("sitename")
当我将yml更改为
时en.yml
en:
home:
sitename: "Happy Sunday"
new.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"}
答案 0 :(得分:1)
消息:
syntax error on line 4, col 6: ` home:'
表示您的Yaml出错。检查en.yml,特别是您没有使用制表符,并且缩进是一致的。