---
module ActionController::PolymorphicRoutes
...
def polymorphic_url
...
# add default locale from session (retrieved from prefix on route
path)
args << {:locale => session[:locale]} if session[:locale]
__send__(named_route, *args)
end
the option :path_prefix is in rails 3 deprecated an will remove in rails
3.1.
Please use this in you routes.rb:
scope "(/:locale)" do
resources :items
end
and in your application controller:
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :set_locale
def set_locale
I18n.locale = params[:locale]
end
def default_url_options(options={})
{:locale => I18n.locale}
end
end
config/application.rb:
config.i18n.default_locale = :de
Cheers,
Michael
-- Michael Voigt Herbert-Weichmann-Str. 35 22085 Hamburg Germany
2010/3/4 Albert Llop <mrs...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups
> "rails-i18n" group.
> To post to this group, send email to rails...@googlegroups.com.
> To unsubscribe from this group, send email to
> rails-i18n+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rails-i18n?hl=en.
>
the option :path_prefix is in rails 3 deprecated an will remove in
rails
3.1.
Please use this in you routes.rb:
scope "(/:locale)" do
resources :items
end
and in your application controller:
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :set_locale
def set_locale
I18n.locale = params[:locale]
end
def default_url_options(options={})
{:locale => I18n.locale}
end
end
config/application.rb:
config.i18n.default_locale = :de
Cheers,
Michael
-- Michael Voigt Herbert-Weichmann-Str. 35 22085 Hamburg Germany