Question

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

Was it helpful?

Solution

You are missing the quotes.

alert('<%= I18n.locale.to_s %>');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top