Open jensb opened 13 years ago
Hi,
Thanks for finding these bugs, I have currently not a lot of time to work on this, so I will try to do it soon, but in the meantime, don't hesitate to try to hack on it !
Thanks!
2011/10/9 jensb < reply@reply.github.com>
Hello,
when using named_route paths with multiple parameters, translations are not detected (so paths are not translated). Attached is a patch which adds four failing tests, to test this.
Failures:
1) localized_routes routes in loop and controller blocks translated named route, from Failure/Error: routes.send(:from_search_path, :country => 'DE', :city => 'HH', :type => 'from').should == '/von/DE/HH' expected: "/von/DE/HH" got: "/from/DE/HH" (using ==)
./spec/i18n_routing/i18n_spec.rb:259
2) localized_routes routes in loop and controller blocks translated named route, to Failure/Error: routes.send(:to_search_path, :country => 'DE', :city => 'HH', :type => 'to').should == '/nach/DE/HH' expected: "/nach/DE/HH" got: "/to/DE/HH" (using ==)
./spec/i18n_routing/i18n_spec.rb:262
3) localized_routes routes in loop and controller blocks translated url_for, from Failure/Error: url_for(:controller => :search, :action => :show, :country => 'DE', :city => 'HH', :type => 'from').should == '/von/DE/HH' expected: "/von/DE/HH" got: "/from/DE/HH" (using ==)
./spec/i18n_routing/i18n_spec.rb:265
4) localized_routes routes in loop and controller blocks translated url_for, to Failure/Error: url_for(:controller => :search, :action => :show, :country => 'DE', :city => 'HH', :type => 'to').should == '/nach/DE/HH' expected: "/nach/DE/HH" got: "/to/DE/HH" (using ==)
./spec/i18n_routing/i18n_spec.rb:268
You can merge this Pull Request by running:
git pull https://github.com/jensb/i18n_routing master
Or you can view, comment on it, or merge it online at:
https://github.com/kwi/i18n_routing/pull/27
-- Commit Summary --
- Added failing test for named routes with extra parameters
-- File Changes --
M spec/i18n_routing/i18n_spec.rb (56) M spec/locales/de.yml (4)
-- Patch Links --
https://github.com/kwi/i18n_routing/pull/27.patch https://github.com/kwi/i18n_routing/pull/27.diff
Reply to this email directly or view it on GitHub: https://github.com/kwi/i18n_routing/pull/27
Hi,
thanks for replyling! I dug some more and found out that your plugin stops working when there are constraints on parameters. E.g.
match "/route/:country/:city" => "search#show", :constraints => { :city => /[A-Za-z0-9_-]/ }
Different parameter separators or SEO optimized paths are OK - only constraints do not work. The translation is found (when using :verbose => true) but it is not used.
If you can point me to where this might go wrong, I'll spray debugging output over my fork and have another look at it.
Also, important to note is that while using constraints, only url_for
does not work, while named routes translate perfectly and use the constraints. So, the constraints options are not lost, but somehow, they prevent translated routes from being created properly.
Please provide some assistance in finding this bug, I'll be happy to create tests and patches for you to pull once I know where to fix it. I don't have too much experience with Rails's internals, so I probably won't find it on my own.
Thanks!
Hello,
when using named_route paths with multiple parameters, translations are not detected (so paths are not translated). Attached is a patch which adds four failing tests, to test this.
Failures: