RESTful routes, Globalite, an optional locale path_prefix?

Hi there,

I have a few internationalized resources:

map.resource :vendors, :path_prefix => "/:locale" map.resource :contacts, :path_prefix => "/:locale" map.resource :galleries, :path_prefix => "/:locale"

I'm using globalite to keep track of all the translated strings and set the locale in a before_filter in the application_controller. Nothing fancy going on here.

I would like the url of "/galleries" to default to "/us/galleries", but not redirect the user to /us/galleries, if that makes sense. I'm sensing there is some route or before_filter magic I must perform, but I'm not sure what that magic should be. An :optional_path_prefix hash is what I'm looking for... maybe?

Thanks! -Dave


Recently I've ran into the same problem. Have you found any clues? And I wonder how you dealt with named routes. I have problems with named routes for nested resources like this:

routes.rb map.resources :galleries, :has_many => :photos, :path_prefix => ":locale"

some_view.html.erb gallery_photo_path(@gallery, @photo) #it produces an error because of missing :locale