Forum: Ruby on Rails Language setting before routing?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F641ba2e0fc906fb77d74b52cf59d187?d=identicon&s=25 Doug Dupory (doug)
on 2006-04-15 00:57
When processing a request, where can you obtain the language setting of
a user's browser?

I know we can read @request.env["HTTP_ACCEPT_LANGUAGE"] in an action
easily. But I need to access it before being routed to a controller's
action... because the accepted language dictates my app's language
setting programmatically and what action to take. (I'm not allowed to
ask a user to specify a preferred language using an URL.) Where in the
Rails *runtime* routing is done?

Any filter, plugin, or even somewhere in the Rails core? I spent 4 hours
to poke around, but didn't get any idea.

Thanks in advance!

DD
06e1b396407b733b4b3d825cb2c57856?d=identicon&s=25 Leo -- (leopardus)
on 2006-04-15 08:26
(Received via mailing list)
You could try to do it in routes.rb, before actual routing code. Or
make mixin and call it from here. Will it violate some Rails
philosophy? I don't know.

--
olegf
F641ba2e0fc906fb77d74b52cf59d187?d=identicon&s=25 Doug Dupory (doug)
on 2006-04-15 18:46
Thank you, Leo, for your pointer! It looks like the recognize() method
is the place to start... it has a user's request and path. Hope to
devise a change/addition that doesn't mess up the Rails core...

DD

Leo -- wrote:
> You could try to do it in routes.rb, before actual routing code. Or
> make mixin and call it from here. Will it violate some Rails
> philosophy? I don't know.
>
> --
> olegf
This topic is locked and can not be replied to.