kwi / i18n_routing

I18n routing module for Rails 2.3.x and Rails 3. Translate your routes with ease !
MIT License
228 stars 48 forks source link

No localized path when the translation is the same as english #4

Closed muitocomplicado closed 14 years ago

muitocomplicado commented 14 years ago

I have a resource called "kits" that is the same in both english and portuguese. The plugin doesn't create the localized paths like pt_kits, new_pt_kit, etc. This is an issue because I want localized path_names, like this:

English: /kits/new and /kits/1/edit Portuguese: /kits/criar and /kits/1/editar

Any ideas?

mixr commented 14 years ago

it's the check in line 39 http://github.com/kwi/i18n_routing/blob/master/lib/i18n_routing_rails3.rb#L39

you could pass in a force parameter to a resource like: resources :kits, :force => [:pt] and check for that; but this is not a good solution. experiment goes here: http://github.com/mixr/i18n_routing/tree/forced_routes

kwi commented 14 years ago

Hi,

Yes, when a translation is not found or is the same, i18n_routing does not translate the route.

I will try to find a clean way to handle this soon.

Thanks for the feedback.

kwi commented 14 years ago

Fixed ! Try it and tell me if something goes wrong :)

mixr commented 14 years ago

It works great for resources, singleton resources seem to work too!

but extra methods on a singleton resource get no named route, independent of the actual translation. resource :foo do resource :bar do get :thing ...

'rake routes' outputs: thing_foo_bar GET /foo/bar/thing(.:format) GET /foo_en/bar_en/thing(.:format) GET /foo_de/bar_de/thing(.:format)

kwi commented 14 years ago

I will check this out soon :) Thanks !

mixr commented 14 years ago

hey,

looks like false alarm. I couldn't reproduce my problem in the tests: http://github.com/mixr/i18n_routing/commit/51b71b055f8ca75637708c897555aa00404aa5cb

In my app, rails3 beta3 and beta4 made all the difference!

muitocomplicado commented 14 years ago

Thanks, it's working fine now. =)