Question

I was looking into How to use rails-i18n with HAML to find out how i18n works together with haml but ran into an issue I can't figure out.

This works:

en.yml

en:
  sitename: "Happy Sunday"

new.haml

%h1= t("sitename")

When I change the yml to

en.yml

en:
  home:
    sitename: "Happy Sunday"

new.haml

%h1= t("home.sitename")

Then I get the following error:

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"}
Was it helpful?

Solution

The message:

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

suggests an error in your Yaml. Check en.yml, especially that you’re not using tabs and that your indentation is consistent.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top