ruby on rails - links to scoped routes -
i'd use scoped routes internationalizing. here's routes.rb
scope "(:locale)", locale: /en|pl/ resources :announcements, only: [:index], path: '/news' resources :diplomas, only: [:index, :show], path: '/graduates' end
goal point urls website.domain/pl/news announcements controller , check params[:locale] in applicationcontroller in before_action
method.
but have problems generating urls. said before want looking urls , sense of aesthetics tells me appname.domain/news/?locales=pl not i'm looking for. :(
so have question:
there option generate links appname.domain/pl/news/ when using scoped routes?
thanks help!
your routes scoped in way, can called this:
your.domain/pl/news your.domain/en/news
if pleases aesthetics.
so, in other word, yes.
have here, on how use , set this:
http://guides.rubyonrails.org/i18n.html#setting-and-passing-the-locale
Comments
Post a Comment