2013-02-22 44 views
0

我正在研究How to use rails-i18n with HAML以瞭解i18n如何與haml一起工作,但遇到了我無法弄清的問題。i18n rails haml的奇怪問題

這工作:

en.yml

en: 
    sitename: "Happy Sunday" 

new.haml

%h1= t("sitename") 

當我改變陽明到

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

第4行,第6列:home:的語法錯誤提示Yaml出現錯誤。檢查'en.yml',特別是你沒有使用標籤,並且你的縮進是一致的。 – matt 2013-02-22 16:43:15

+0

我使用了標籤!用空白替換它們可以解決問題!非常感謝! – stiebitzhofer 2013-02-22 16:55:46

回答

1

消息:

syntax error on line 4, col 6: ` home:' 

暗示你的Yaml有錯誤。檢查en.yml,尤其是你沒有使用製表符並且縮進是一致的。