RouteTranslator gem is wrapping the current locale assignment in an around_filter set_locale_from_url and then resets it to the previous value.
Devise has a FailureApp to deal with unauthenticated requests, and it uses I18n to build the flash message and the redirection URL. But at that stage, the I18n default locale is set and the messages and URL are not localized in the context of the request (i.e. if the request URL is in French, and the default locale of the app is English, Devise will redirect to the English URL with an english flash message).
This is a solution for propagating the application locale to the the Devise middleware.
Thanks for the gist!
It looks like mistake in this line: https://gist.github.com/frahugo/705b0854126eb3ae7565#file-translated_failure_app-rb-L34
I guess it should be
request.env['app.current_locale']