Spending hours now figuring this out. It seems the gem is not really
functional beyond basic routes in rails 3.1.1
I managed now to get the named routes lookup working like this:
fr-CH:
routes:
advertise:
as: advertise-fr-CH
ruby-1.9.2-p290 > app.advertise_path
=> "/advertise-fr-CH"
However, I don't see any documentation for this. I had to look into
the source code, which isn't easy to read.
When adding a nested route to the user routes like this:
localized([:'de-CH', :'fr-CH'], :verbose => true) do
resources :users do
resources :videos
end
end
with
fr-CH:
routes:
users:
as: users-fr-CH
path_names:
new: new-fr-CH
path_names.new is wrongly recognized as belonging to videos and the
new path segment for new_user_path is not translated.
To fix this I can work around that by removing the nested resource and
adding an extra block:
resources :users do
localized([:'de-CH', :'fr-CH'], :verbose => true) do
resources :videos
end
end
However, this is not very clean and I also don't know where to store
the translations for the nested videos resource.
Is that gem actually maintained? Would be a pitty if not, as it is one
of the very few options for translating routes in rails.
On 13 Okt., 14:40, Guillaume Luccisano <
guillaume.luccis...@gmail.com>
wrote:
> Hmm, right now, I have no idea, (sorry long time I haven't use the gem) but
> this notation should be the most usable one.
> You can't do named path with it ?
>
> 2011/10/13 nico <
nico.rits...@googlemail.com>