Comments (5)
Is there another version of this gem that works with Rails 4? I still cannot get this working.
from routing-filter.
I have exactly the same problem with 0.4.0.pre in combination with a Rails 4 app. Both the standard locale filter as well as a custom filter do not work properly. The locale is read out from URLs (meaning params[:locale] is properly set), but unfortunately it is not included automatically anymore in URLs generated within Rails.
from routing-filter.
A few days ago I rewrote my routing logic to use what Rails 4 provided and removed the gem. I had another issue with my custom error pages not working anymore with I18n that was more critical for me to correct. At least I was able to get the routing working without the gem. I ended up rewriting my custom error pages in HTML and putting them in the public folder. By naming them as 404.en.html, 404.fr.html, etc. the correct page is displayed depending on the locale.
I will leave the issue open for now just in case I may decide to use this gem again.
from routing-filter.
This issue seems to be the same issue as #47. The monkey patch there can help you (temporarily) fix this problem. However, I think this is not ideal.
May I ask how you solved this with the solutions provided by Rails 4?
from routing-filter.
I removed config.exceptions_app from application.rb since it appears that it has been deprecated. This is what I used for my custom error pages.
Here is the scope statement in routes.rb I'm using.
scope "(/:locale)", locale: /#{I18n.available_locales.join("|")}/ do
my routes here
end
This scope statement includes the locale in the routes (i.e. /en, /fr, ) but allows the locale to default to en if no locale is in the URL. For example http://mydomain.com/home and http://mydomain.com/en/home will both display the English version of the view. You will get the same results by using the following.
scope "(/:locale)" do
my routes here
end
The only difference I know of is that the first scope statement will display the locales when you do rake routes to list your defined routes. The second one does not. There are probably other differences that I am not aware of.
I then created separate error pages for each locale using HTML and placed them in the public folder. I did not have to add any code to lib/tasks like earlier versions required starting with Rails 2. I guess the code that was required is now included in Rails 4. As I mentioned when I get errors while using the English version of the website the error file nnn.en.html is displayed. If I get and error using the French version nnn.fr.html is displayed, etc.
from routing-filter.
Related Issues (20)
- Didn't work on rails 4 HOT 2
- Is this gem support alive? HOT 2
- Devise "Not found. Authentication passthru."
- rails4 undefined local variable or method map HOT 5
- Set :include_default_locale to true ignored HOT 5
- Support for case insensitive locales HOT 9
- Is there a plan to support Rails 5 ?
- New release ? HOT 8
- How to use filter in a block?
- I'm not able to make a custom filter work
- Routing Error instead of fallback to en
- Avoiding duplicate content SEO penalty HOT 2
- Why default locale is not fallen back to? HOT 1
- Update routing-filter to allow rails 5.2
- Won't work with Rails 6.1 HOT 5
- Please release new gem version HOT 4
- Filter locale breaks default_url_options in tests (setting the Locale from URL Params)
- README and repo description (on github) reference artweb-design HOT 1
- routing-filter doesn't seem to work with rails 7.1 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from routing-filter.