For Rails 3.2 and under

RoutingFilterLocaleUnlessAPI filter extracts segments matching /:locale from
the beginning of the recognized path and exposes the locale parameter
as params[:locale]. When a path is generated the filter adds the segments
to the path accordingly if the locale parameter is passed to the url helper.