Javascript variables

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.userLanguage

how 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.