From 15ef8b0d51f9610f52b8e94ba16691f4e512f0d0 Mon Sep 17 00:00:00 2001 From: Jocelyn Jaubert Date: Sun, 23 Oct 2011 10:54:38 +0200 Subject: Add translation on wiki description, falling back to english --- web/taginfo.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'web') diff --git a/web/taginfo.rb b/web/taginfo.rb index c65ce37..276feb2 100755 --- a/web/taginfo.rb +++ b/web/taginfo.rb @@ -193,7 +193,8 @@ class Taginfo < Sinatra::Base @count_all_values = @db.select("SELECT count_#{@filter_type} FROM db.keys").condition('key = ?', @key).get_first_value().to_i - @desc = h(@db.select("SELECT description FROM wiki.wikipages WHERE lang='en' AND key=? AND value IS NULL", @key).get_first_value()) + @desc = h(@db.select("SELECT description FROM wiki.wikipages WHERE lang=? AND key=? AND value IS NULL", r18n.locale.code, @key).get_first_value()) + @desc = h(@db.select("SELECT description FROM wiki.wikipages WHERE lang='en' AND key=? AND value IS NULL", @key).get_first_value()) if @desc == '' @desc = "#{ t.pages.key.no_description_in_wiki }" if @desc == '' @prevalent_values = @db.select("SELECT value, count_#{@filter_type} AS count FROM tags"). @@ -267,7 +268,8 @@ class Taginfo < Sinatra::Base @count_all = @db.select('SELECT count_all FROM db.tags').condition('key = ? AND value = ?', @key, @value).get_first_value().to_i - @desc = h(@db.select("SELECT description FROM wiki.wikipages WHERE lang='en' AND key=? AND value=?", @key, @value).get_first_value()) + @desc = h(@db.select("SELECT description FROM wiki.wikipages WHERE lang=? AND key=? AND value=?", r18n.locale.code, @key, @value).get_first_value()) + @desc = h(@db.select("SELECT description FROM wiki.wikipages WHERE lang='en' AND key=? AND value=?", @key, @value).get_first_value()) if @desc == '' @desc = "#{ t.pages.tag.no_description_in_wiki }" if @desc == '' erb :tag -- cgit v1.2.3