rails routes locale, gem 'route_translator' or gem 'i18n_routing' unable to translate match in resource
-
01-07-2021 - |
Question
- mainly i would use i18n_routing gem i will be happy if i will translate match 'vlk' under dashboard resource, trying everything around, and no success. Resources are translated successfully also new action...whats wrong?
routes.rb
MyApp::Application.routes.draw do
root :to => 'home#index'
localized do
resources :cars
resource :admin, :controller => :admin
resource :dashboard do
member do
match 'vlk', :as => :vlk
end
end
end
end
routes.yml
cs:
cars: 'auta'
admin: 'admincesky'
routes:
dashboard:
as: 'novy'
path_names:
new: 'cesky_member'
vlk: 'tzz_cesky'
named_routes_path:
vlk: 'tzz_cesky'
2.secondly, i tried next gem 'route_translator' and i cant get running 'route_translator' gem i am getting this error
/ruby-1.9.2-p320/gems/actionpack-3.0.14/lib/action_dispatch/routing/route.rb:25:in `initialize': can't convert Array into String (TypeError)
if i add line at the end of routes.rb file
Dt::Application.routes.translate_from_file('config/locales/routes.yml')
Solution
I had the same problem.
I tried a lot - without any solution.
I tried this gem https://github.com/kwi/i18n_routing - that fixed my problems :-)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow