Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use rails-i18n with HAML

I went through http://guides.rubyonrails.org/i18n.html and set up my en.yml file:

en:
  test:
    welcome: Welcome!!!
  registration:
    signup: Sign up for an invite!!

However, in my new.html.haml file, How do I reference signup?

The tutorial only shows how to do so using ERB, not HAML. I tried this and it didn't work:

%h2 <%=t :registration.signup %>

Any ideas?

like image 800
netwire Avatar asked Jun 08 '12 11:06

netwire


1 Answers

You should probably read the HAML reference to understand how HAML works. To add code to generate content for a tag, you use =, as in:

%h2= t('registration.signup')
like image 123
Maurício Linhares Avatar answered Nov 02 '22 21:11

Maurício Linhares