diff options
author | Jochen Topf <jochen@topf.org> | 2010-11-22 18:14:13 +0100 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2010-11-22 18:14:13 +0100 |
commit | 1e47c73779badf2bf3f68309820d4eae02f335b8 (patch) | |
tree | dd2fe406600cb35c7b409ccda81f0889b78dd9f6 /web/taginfo.rb | |
parent | d7b01517714d16c3d8f57c34607a2579bd7ae8eb (diff) | |
download | taginfo-1e47c73779badf2bf3f68309820d4eae02f335b8.tar taginfo-1e47c73779badf2bf3f68309820d4eae02f335b8.tar.gz |
More translations. Fixed locale switch
Diffstat (limited to 'web/taginfo.rb')
-rwxr-xr-x | web/taginfo.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/web/taginfo.rb b/web/taginfo.rb index 603fd29..265f4b0 100755 --- a/web/taginfo.rb +++ b/web/taginfo.rb @@ -89,12 +89,9 @@ class Taginfo < Sinatra::Base end before do -# if params[:locale] -# response.set_cookie('taginfo_locale', params[:locale]) -# elsif request.cookies['taginfo_locale'] -# params[:locale] = request.cookies['taginfo_locale'] -# end - params[:locale] = 'en' + if request.cookies['taginfo_locale'] && request.path != '/switch_locale' + params[:locale] = request.cookies['taginfo_locale'] + end javascript 'jquery-1.4.2.min' javascript 'jquery-ui-1.8.6.custom.min' @@ -122,6 +119,15 @@ class Taginfo < Sinatra::Base #------------------------------------- + # This is called when the language is changed with the pull-down menu in the top-right corner. + # It sets a cookie and redirects back to the page the user was coming from. + get '/switch_locale' do + response.set_cookie('taginfo_locale', params[:locale]) + redirect params[:url] + end + + #------------------------------------- + get '/' do @tags = @db.select("SELECT key, scale1 FROM popular_keys ORDER BY scale1 DESC LIMIT #{ TAGCLOUD_NUMBER_OF_TAGS }"). execute(). |