ruby on rails - Problems Using routing-filter beta version 0.4.0.pre -


i using 0.4.0.pre version of routing-filter rails 4 @ suggestion of person posted version in rubygems. not find version when search on rubygems website. found out when posted comment on existing issue in github.

https://rubygems.org/gems/routing-filter/versions/0.4.0.pre

i finding differences between version , 1 use in rails 3 applications. believe latest version 0.3.1. gem locale included in urls , in debug info @ bottom when running localhost expected. when use 0.4.0.pre version locales not show in urls or debug info. have links @ top of header section person can select locale. when 1 of links clicked locale appears in url. when click link (text or icon) locale disappears locale set in cookie (a supposed no no keep now). translations correct selected locale unless special in links person know 1 clicked, no 1 know locale. problem because setting locale files , of them in english until able translations other languages.

here code have in both applications in application_controller.rb set locale , create cookie.

before_filter :set_locale  private   def set_locale     i18n.locale = (params[:locale] if params[:locale].present?) || cookies[:locale] || 'en'     cookies[:locale] = i18n.locale if cookies[:locale] != i18n.locale.to_s   end 

here code have in config/routes.rb.

filter :locale 

here code locale line in header in rails 4 application. have similar code in rails 3.2.13 application.

<%= link_to_unless_current "english", locale: "en" %> <%= link_to_unless_current "español", locale: "es" %> <%= link_to_unless_current "français", locale: "fr" %> 

i'm not sure if issue 0.4.0.pre gem or if need make additional i18n changes in rails 4 application. reading i18n documentation i'm not seeing additional need do. there no specific documentation 0.4.0.pre assume should able doing rails 3 version of routing-filter.

i have posted in issue section gem in github. have done online searches using version of routing-filter cannot find them. think posted last month.

any appreciated.

it looks problem has been corrected problem locale not appearing in url. ended using native rails code routing since had 2 applications in production had rewritten in rails 4.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -