I want to execute the following javascript functions in a model or in
a controller, and work with result .
navigator.systemLanguage
navigator.userLanguage
how can i do?
I want to execute the following javascript functions in a model or in
a controller, and work with result .
navigator.systemLanguage
navigator.userLanguage
how can i do?
Jean-sébastien Jney wrote:
I want to execute the following javascript functions in a model or in
a controller, and work with result .
navigator.systemLanguage
navigator.userLanguagehow can i do?
Models and controllers are server-side entities.
and? ajax is asynchronous so i can you code i’ve taken from client in
my server side
thanks philips, i knew it, it is request.env[“HTTP_ACCEPT_LANGUAGE”],
but those javascript functions give me navigator language and os
language.
anyway i think you’re right i will use this method.
Jean-Sébastien wrote:
I want to execute the following javascript functions in a model or in
a controller, and work with result .
navigator.systemLanguage
navigator.userLanguage
Add this to an action:
raise request.env.inspect
That shows the HTTP headers. One of them should specify the language.
–
Phlip
Test Driven Ajax (on Rails) [Book]
“Test Driven Ajax (on Rails)”
assert_xpath, assert_javascript, & assert_ajax
Jean-sébastien Jney wrote:
thanks philips, i knew it, it is request.env[“HTTP_ACCEPT_LANGUAGE”],
but those javascript functions give me navigator language and os
language.
anyway i think you’re right i will use this method.
Yes, you can work with request headers on the server side, since servers
actually know about requests.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs