ruby - Setting Sinatra template options works locally, broken on Heroku -


My Sinatra Web site uses a valid ghetto approach to switch between two languages, which can be used on my local machine Works perfectly, but not everyone.

My app.rb is as follows:

  requires 'sinatra' to set '/': erb,: views = & Gt; Settings.views + "/ en" erb: index, layout = & gt; False ,: View = & gt; Setting.views end get '/ tr': erb ,: views = & gt; Retrieve settings.views + "/ tr" ('/ home') Finally set '/ en': erb ,: views = & gt; Retrieve settings.views + "/ n" ('/ Home') '/ Home': 'Home' for 'Android' and 'Make Products': Product End ...   

When I click on the link to the / en and / tr URLs, then type me correctly / home link, but there is no change in the consideration folder.

My gems are similar versions in both environments:

  Rack (1.4.1) Rack-Protection (1.2.0) Tilting (1.3.3) Papara (1.3. 3) Bundler (1.3.2)   

Help, please.

Suggestion to change your undoubtedly misleading way with something stronger like the I18n gem

And instead of using it, the browser's language (for example) you can do something in the first filter like this

  . Set path_info when / ^ \ / tr / again: locale, "tr" and set: locale, "n" and end   

and in the helpers

  Helpers get def get_locale settings.locale end # othe end of the example   

With this help, you only need a copy of your visual template, when you have only one element (for example ), Then reducing the complexity of changing all the visuals >

If you want to test your Syantra app Such that it will work on your locks so you can throw to start your server before the RACK_ENV = output before. RACK_ENV = Output Ruby my_app.rb

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -