Get a rails locale language value in a javascript function

in my environment.rb, the languge is defined :

GLoc.set_config :default_language => :en

when loading another page , a specific javascript function need to
get this local as a var
var useLanguage = “##”

is it possible ?

On 22 Jul 2008, at 23:06, Erwin wrote:

in my environment.rb, the languge is defined :

GLoc.set_config :default_language => :en

when loading another page , a specific javascript function need to
get this local as a var
var useLanguage = “##”

You’d have to generate some javascript with the appropriate values in
it (you could do this from an initializer for example, just write out
what you need to public/javascripts/language.js and include that
javascript file where relevant).

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs