In my site, the locale is determined by a query parameter that is appended to the URL (e.g. <http://www.mysite.com/mypage?locale=en>).

I'm using devise with `before_filter :authenticate_user!` in my application controller, but couldn't figure how to pass the locale parameter to devise sign in view (If I manually add this to the view URL after it's presented, it does show the translated view, it's just passing the parameter that I can't figure out)

I added the following to my application controller, which didn't do the trick:

```
  before_filter :set_locale

  def set_locale
    I18n.locale = params[:locale] || I18n.default_locale
  end

  def default_url_options(options={})
    { locale: I18n.locale }
  end

```