I have a Rails 3.2.13 application that has been localized for English and French. When I first localized the application I was using the routing-filter gem. When I started working on a Rails 4.0.0 application I attempted to use the 4.0 beta version of the gem but could not get it to work. I decided to rewrite the routing of my Rails 3.2.13 applications to use the built-in I18n routing functionality. My applications use custom error pages using Self.routes. Everything in my application is working properly except for the custom error pages. For example if I get a 404 error instead of the correct custom error page for the locale displaying it appears that the locale value is changed to 404 and attempts to display the landing page looking for translations for locale 404.

I have done a lot of web searching since yesterday but have not found any examples of how to do this using I18n. The 3.2.13 routing-filter gem took care of this.

Here is the link to Stack Overflow where I posted the question. It includes details of exactly what is happening and the code I'm attempting to execute.

I never got any responses here on on my initial question on Stack Overflow. I decided to abandon this process and see if I could find a way to do this in the public folder. It was difficult to find documentation for this as well. I decided to post another question about this a couple of weeks ago.

Unfortunately I did not hear anything again. I guess there are not a lot of people localizing Rails applications. I ended up making a guess and finding a solution that works well. I detail what I did in the link below. It appears that config.exceptions_app = self.routes has been deprecated. At least in my situation it was completely ignored. Thankfully it is a lot easier to do custom error pages using I18n in Rails 4.

Hey LightBeCorp, thanks for coming back with the results. I'm going to be building an app soon that will need i18n and it'd be super useful to know if you have a link to the complete solution for rails 4.

I just saw the response from you gorrillamcd. I found out with Rails 4 that it is a lot easier to implement custom error pages. You don't have to do any special configuration at all. Just create a separate error page for each locale in the public folder. For example I have four locales in one of my Rails 4 applications. For error 404 I have 404.en.html, 404.fr.html, 404.pt.html and 404.es.html. I have done the same for error 500. I could not find documentation for this. I just decided to try it and see if it worked.

I saw something like this on Stack Overflow for Rails 2 but the configuration was so complicated that I did not bother to try it.