0

I am trying to do an 'if' statement depending on the language and do to find the right way to make JS to find the locale.

As as I trial I have tried with similar combinations to this, but no avail.

alert(<%= I18n.locale.to_s %>);

The page loads but no alert is shown.

Any idea what I am missing?

Thanks

Sergio Nekora
  • 319
  • 1
  • 5
  • 19

1 Answers1

3

You are missing the quotes.

alert('<%= I18n.locale.to_s %>');
Simone Carletti
  • 173,507
  • 49
  • 363
  • 364