| Path: | lib/routing_filter/filters/locale.rb |
| Last Update: | Wed Dec 21 14:15:47 +0200 2011 |
The Locale filter extracts segments matching /:locale from the beginning of the recognized path and exposes the page parameter as params[:page]. When a path is generated the filter adds the segments to the path accordingly if the page parameter is passed to the url helper.
incoming url: /de/products/page/1 filtered url: /de/products params: params[:locale] = 'de'
You can install the filter like this:
# in config/routes.rb
Rails.application.routes.draw do
filter :locale
end
To make your named_route helpers or url_for add the pagination segments you can use:
products_path(:locale => 'de') url_for(:products, :locale => 'de'))