diff options
author | Jochen Topf <jochen@topf.org> | 2010-11-10 23:33:24 +0100 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2010-11-10 23:33:24 +0100 |
commit | 8659836de44428298bf214b9d556f64791731760 (patch) | |
tree | 3a1b78b34052bbb1d97abfd9f20af7aefe150655 /web/taginfo.rb | |
parent | 63cc77aa8854837e76e10c853ceca23eab765fe1 (diff) | |
download | taginfo-8659836de44428298bf214b9d556f64791731760.tar taginfo-8659836de44428298bf214b9d556f64791731760.tar.gz |
preparations for i18n
Diffstat (limited to 'web/taginfo.rb')
-rwxr-xr-x | web/taginfo.rb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/web/taginfo.rb b/web/taginfo.rb index 499e643..8bc5233 100755 --- a/web/taginfo.rb +++ b/web/taginfo.rb @@ -28,10 +28,12 @@ #------------------------------------------------------------------------------ require 'rubygems' -require 'sinatra/base' require 'json' require 'sqlite3' +require 'sinatra/base' +require 'sinatra/r18n' + require 'lib/utils.rb' require 'lib/language.rb' require 'lib/sql.rb' @@ -45,6 +47,8 @@ TAGCLOUD_NUMBER_OF_TAGS = 200 class Taginfo < Sinatra::Base + register Sinatra::R18n + configure do set :app_file, __FILE__ @@ -65,7 +69,21 @@ class Taginfo < Sinatra::Base alias_method :h, :escape_html end + # make trimming \n after %> the default in erb templates + alias_method :erb_orig, :erb + def erb(template, options={}, locals={}) + options[:trim] = '>' unless options[:trim] + erb_orig template, options, locals + 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' + @db = SQL::Database.new('../../data') @data_until = @db.select("SELECT min(data_until) FROM master_meta").get_first_value().sub(/:..$/, '') |