Closed zackxu1 closed 12 years ago
After reading the source-code, I see what this gem is doing:
The Locale filter extracts segments matching /:locale from the beginning of the recognized path and exposes the page parameter as params[:locale]. 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 filtered url: /products params: params[:locale] = 'de'
You can install the filter like this:
Rails.application.routes.draw do filter :locale end
To make your named_route helpers or url_for add the locale segments you can use:
products_path(:locale => 'de') url_for(:products, :locale => 'de'))
I added the needed logic to application_controller.rb so it's all working.
As a suggestion, maybe you want to add the above to the gem documentation so it's more clear what this gem is doing for persisting locale. Thanks, this is a great gem! Zack
Hello.
I installed and set up routing-filter as described on the gem documentation page.
It works for the default locale. For example, if I set up my default locale as :en, the site is in English, and if I set my default locale as :zh, the site in Chinese.
But how can I make my site support BOTH languages? when the default locale is :zh, I tried to change the URL by changing the "zh" to "en" but the page is still in Chinese, not English.
Is this something not supported by this gem? If not, is there some other gem I can use? Or have I not set up the routing-filter gem properly?
Thanks! Zack